Handling DATE_ADD

This commit is contained in:
Louis Lam 2023-02-12 16:59:07 +08:00
parent 5388a37a26
commit 2e2747fb52
7 changed files with 34 additions and 7 deletions

View file

@ -683,6 +683,15 @@ class Database {
static async shrink() {
await R.exec("VACUUM");
}
static sqlHourOffset() {
if (this.dbConfig.client === "sqlite3") {
return "DATETIME('now', ? || ' hours')";
} else {
return "DATE_ADD(NOW(), INTERVAL ? HOUR)";
}
}
}
module.exports = Database;