initial commit

This commit is contained in:
2023-06-30 16:22:08 +02:00
commit 78f3961b11
39 changed files with 5136 additions and 0 deletions

20
db/init_db.js Normal file
View File

@@ -0,0 +1,20 @@
import fs from 'fs';
import Database from 'better-sqlite3';
const dbName = 'strimserve.db';
// Read the schema file
const schema = fs.readFileSync('schema.sql', 'utf8');
// Create a new database object and initialize it with the schema
const db = new Database(dbName);
try {
console.log(`Connected to the ${dbName} database.`);
db.exec(schema);
console.log('Schema initialized successfully.');
} catch (err) {
console.error(err.message);
} finally {
db.close();
}