init: 初始化

This commit is contained in:
ethan.chen
2025-06-13 13:56:26 +08:00
commit c60fde3321
11 changed files with 399 additions and 0 deletions

21
db/index.ts Normal file
View File

@@ -0,0 +1,21 @@
/*
* @Date: 2025-06-12 16:48:44
* @LastEditors: 陈子健
* @LastEditTime: 2025-06-12 17:31:37
* @FilePath: /my-score/honoback/db/index.ts
*/
import { DatabaseSync } from "node:sqlite"
import { join, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { readFileSync } from 'node:fs'
const __dirname = dirname(fileURLToPath(import.meta.url))
// 初始化数据库连接
const db = new DatabaseSync(join(__dirname, 'media.db'))
// 执行schema.sql中的SQL语句
const schema = readFileSync(join(__dirname, 'schema.sql'), 'utf-8')
db.exec(schema)
export { db }

BIN
db/media.db Normal file

Binary file not shown.