阿里云 MySQL 到期了,续费 48 元/月,果断换 SQLite。
步骤
- 备份阿里云 MySQL 实例(导出 SQL 文件)
- 处理 SQL 语句中的类型差异
- 生成 SQLite db 文件
- 修改项目中的 SQL 语句
// Koa 框架中使用 sqlite3
var res = yield new Promise(function (resolve, reject) {
self.db.run(
"insert into comments values (?,?,?,?,?,?,?)",
[null, comment.blogID, comment.name, comment.email, comment.content, comment.addTime, comment.relID]
);
self.db.get(
"select * from comments where blogID = ? and name = ?",
[comment.blogID, comment.name],
function (err, rows) { resolve(rows); }
);
});
省了 48 元/月 ^_^