re init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
let sqlite3 = require('sqlite3').verbose();
|
||||
const path = require('path');
|
||||
let db = new sqlite3.Database('./haiku.db');
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const fs = require('fs');
|
||||
let init = fs.readFileSync(path.join(__dirname, './init.sql')).toString();
|
||||
|
||||
await db.exec(init, (e, res) => {
|
||||
if (e) {
|
||||
console.log(e);
|
||||
} else {
|
||||
console.log(" - DB init CHECK DONE");
|
||||
}
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS "Line5" (
|
||||
id INTEGER PRIMARY KEY,
|
||||
line TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS "Line7" (
|
||||
id INTEGER PRIMARY KEY,
|
||||
line TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
Reference in New Issue
Block a user