chore: 提交剩余的 server 更改

- .env: 数据库路径配置
- scripts/add-reminder-times.cjs: 批量更新提醒时间脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ddshi 2026-02-10 11:11:14 +08:00
parent 15918f163c
commit e44183e3e0
4 changed files with 32 additions and 5 deletions

2
.env
View File

@ -8,7 +8,7 @@ JWT_EXPIRES_IN=7d
JWT_REFRESH_EXPIRES_IN=30d JWT_REFRESH_EXPIRES_IN=30d
# Database (SQLite for local development, PostgreSQL for production) # Database (SQLite for local development, PostgreSQL for production)
DATABASE_URL=E:/qia/server/prisma/dev.db DATABASE_URL=file:./prisma/dev.db
# PostgreSQL (for production - Tencent Cloud) # PostgreSQL (for production - Tencent Cloud)
# DATABASE_URL=postgresql://qia_admin:your-password@postgres.ap-shanghai.myqcloud.com:5432/qia # DATABASE_URL=postgresql://qia_admin:your-password@postgres.ap-shanghai.myqcloud.com:5432/qia

7
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "qia-server", "name": "qia-server",
"version": "0.1.0", "version": "0.2.0-alpha",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "qia-server", "name": "qia-server",
"version": "0.1.0", "version": "0.2.0-alpha",
"dependencies": { "dependencies": {
"@libsql/client": "^0.17.0", "@libsql/client": "^0.17.0",
"@prisma/adapter-libsql": "^7.3.0", "@prisma/adapter-libsql": "^7.3.0",
@ -19,7 +19,6 @@
"express-validator": "^7.1.0", "express-validator": "^7.1.0",
"helmet": "^8.0.0", "helmet": "^8.0.0",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"sql.js": "^1.13.0",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
@ -31,6 +30,7 @@
"@types/jsonwebtoken": "^9.0.7", "@types/jsonwebtoken": "^9.0.7",
"@types/node": "^22.5.5", "@types/node": "^22.5.5",
"prisma": "^5.22.0", "prisma": "^5.22.0",
"sql.js": "^1.13.0",
"tsx": "^4.19.0", "tsx": "^4.19.0",
"typescript": "^5.6.2" "typescript": "^5.6.2"
} }
@ -2321,6 +2321,7 @@
"version": "1.13.0", "version": "1.13.0",
"resolved": "https://registry.npmmirror.com/sql.js/-/sql.js-1.13.0.tgz", "resolved": "https://registry.npmmirror.com/sql.js/-/sql.js-1.13.0.tgz",
"integrity": "sha512-RJbVP1HRDlUUXahJ7VMTcu9Rm1Nzw+EBpoPr94vnbD4LwR715F3CcxE2G2k45PewcaZ57pjetYa+LoSJLAASgA==", "integrity": "sha512-RJbVP1HRDlUUXahJ7VMTcu9Rm1Nzw+EBpoPr94vnbD4LwR715F3CcxE2G2k45PewcaZ57pjetYa+LoSJLAASgA==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/statuses": { "node_modules/statuses": {

View File

@ -24,7 +24,6 @@
"express-validator": "^7.1.0", "express-validator": "^7.1.0",
"helmet": "^8.0.0", "helmet": "^8.0.0",
"jsonwebtoken": "^9.0.2", "jsonwebtoken": "^9.0.2",
"sql.js": "^1.13.0",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
@ -36,6 +35,7 @@
"@types/jsonwebtoken": "^9.0.7", "@types/jsonwebtoken": "^9.0.7",
"@types/node": "^22.5.5", "@types/node": "^22.5.5",
"prisma": "^5.22.0", "prisma": "^5.22.0",
"sql.js": "^1.13.0",
"tsx": "^4.19.0", "tsx": "^4.19.0",
"typescript": "^5.6.2" "typescript": "^5.6.2"
} }

View File

@ -0,0 +1,26 @@
const initSqlJs = require('sql.js');
const fs = require('fs');
async function main() {
const SQL = await initSqlJs();
const db = new SQL.Database('e:/qia/server/prisma/dev.db');
try {
db.run("ALTER TABLE events ADD COLUMN reminder_times TEXT DEFAULT NULL");
console.log('reminder_times column added successfully');
} catch (error) {
if (error.message.includes('duplicate column name') || error.message.includes('already exists')) {
console.log('reminder_times column already exists');
} else {
console.error('Error:', error.message);
}
}
const data = db.export();
const buffer = Buffer.from(data);
fs.writeFileSync('e:/qia/server/prisma/dev.db', buffer);
db.close();
}
main().catch(console.error);