diff options
author | Julien Dessaux | 2023-01-05 02:09:07 +0100 |
---|---|---|
committer | Julien Dessaux | 2023-01-05 02:09:07 +0100 |
commit | d7ed1196bdd44d7734d41d91a5e72a71785e0a08 (patch) | |
tree | aafae6571d5154dc5e9a061c8f54ca8e9b1287ad /database/db.js | |
parent | Added more tests (diff) | |
download | jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.gz jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.bz2 jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.zip |
switched to single quotes string in eslint
Diffstat (limited to '')
-rw-r--r-- | database/db.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/database/db.js b/database/db.js index 1e8b50d..1d8a3f0 100644 --- a/database/db.js +++ b/database/db.js @@ -1,27 +1,27 @@ -import fs from "fs"; -import Database from "better-sqlite3"; +import fs from 'fs'; +import Database from 'better-sqlite3'; const allMigrations = [ - "database/000_init.sql", - "database/001_games.sql", + 'database/000_init.sql', + 'database/001_games.sql', ]; const db = new Database( - process.env.NODE_ENV === "test" ? "testjdm.db" : "jdm.db", - process.env.NODE_ENV === "development" ? { verbose: console.log } : null + process.env.NODE_ENV === 'test' ? 'testjdm.db' : 'jdm.db', + process.env.NODE_ENV === 'development' ? { verbose: console.log } : null ); -db.pragma("foreign_keys = ON"); +db.pragma('foreign_keys = ON'); db.transaction(function migrate() { let version; try { - version = db.prepare("SELECT version FROM schema_version").get().version; + version = db.prepare('SELECT version FROM schema_version').get().version; } catch { version = 0; } if (version === allMigrations.length) return; while (version < allMigrations.length) { - db.exec(fs.readFileSync(allMigrations[version], "utf8")); + db.exec(fs.readFileSync(allMigrations[version], 'utf8')); version++; } db.exec(`DELETE FROM schema_version; INSERT INTO schema_version (version) VALUES (${version});`); |