update db management scripts to bun

This commit is contained in:
2025-05-24 16:24:05 +02:00
parent d50499f41f
commit dd343656cb
3 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import fs from 'fs';
import Database from 'better-sqlite3';
import { Database } from 'bun:sqlite';
const dbName = 'strimserve.db';

View File

@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import Database from 'better-sqlite3';
import { Database } from 'bun:sqlite';
import dotenv from 'dotenv';
dotenv.config({ path: '../.env' });
@@ -23,7 +23,7 @@ const lookup = {
};
// Retrieve existing IDs from Stream
const existingIds = db.prepare('SELECT id FROM Stream').pluck().all();
const existingIds = db.prepare('SELECT id FROM Stream').all().map(row => row.id);
// Create a set of existing IDs for efficient lookup
const idSet = new Set(existingIds);

View File

@@ -10,8 +10,8 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"init_db": "cd db && node ./init_db.js",
"update_db": "cd db && node ./update_db.js",
"init_db": "cd db && bun --bun ./init_db.js",
"update_db": "cd db && bun --bun ./update_db.js",
"generate_iconfont_subset": "cd scripts && bash ./generate_iconfont_subset.sh"
},
"dependencies": {