update db management scripts to bun
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import fs from 'fs';
|
||||
import Database from 'better-sqlite3';
|
||||
import { Database } from 'bun:sqlite';
|
||||
|
||||
const dbName = 'strimserve.db';
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user