chore: add .gitignore, remove VSCode settings, and optimize database queries
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
/*
|
||||
* @Date: 2025-06-12 16:48:44
|
||||
* @LastEditors: 陈子健
|
||||
* @LastEditTime: 2025-06-12 17:31:37
|
||||
* @LastEditTime: 2025-06-13 14:23:03
|
||||
* @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 }
|
||||
export { db }
|
||||
|
||||
Reference in New Issue
Block a user