chore: 提交剩余的 server 更改
- .env: 数据库路径配置 - scripts/add-reminder-times.cjs: 批量更新提醒时间脚本 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
15918f163c
commit
e44183e3e0
2
.env
2
.env
@ -8,7 +8,7 @@ JWT_EXPIRES_IN=7d
|
||||
JWT_REFRESH_EXPIRES_IN=30d
|
||||
|
||||
# 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)
|
||||
# DATABASE_URL=postgresql://qia_admin:your-password@postgres.ap-shanghai.myqcloud.com:5432/qia
|
||||
|
||||
7
package-lock.json
generated
7
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "qia-server",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0-alpha",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "qia-server",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0-alpha",
|
||||
"dependencies": {
|
||||
"@libsql/client": "^0.17.0",
|
||||
"@prisma/adapter-libsql": "^7.3.0",
|
||||
@ -19,7 +19,6 @@
|
||||
"express-validator": "^7.1.0",
|
||||
"helmet": "^8.0.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"sql.js": "^1.13.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -31,6 +30,7 @@
|
||||
"@types/jsonwebtoken": "^9.0.7",
|
||||
"@types/node": "^22.5.5",
|
||||
"prisma": "^5.22.0",
|
||||
"sql.js": "^1.13.0",
|
||||
"tsx": "^4.19.0",
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
@ -2321,6 +2321,7 @@
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmmirror.com/sql.js/-/sql.js-1.13.0.tgz",
|
||||
"integrity": "sha512-RJbVP1HRDlUUXahJ7VMTcu9Rm1Nzw+EBpoPr94vnbD4LwR715F3CcxE2G2k45PewcaZ57pjetYa+LoSJLAASgA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
"express-validator": "^7.1.0",
|
||||
"helmet": "^8.0.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"sql.js": "^1.13.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -36,6 +35,7 @@
|
||||
"@types/jsonwebtoken": "^9.0.7",
|
||||
"@types/node": "^22.5.5",
|
||||
"prisma": "^5.22.0",
|
||||
"sql.js": "^1.13.0",
|
||||
"tsx": "^4.19.0",
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
|
||||
26
scripts/add-reminder-times.cjs
Normal file
26
scripts/add-reminder-times.cjs
Normal 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);
|
||||
Loading…
x
Reference in New Issue
Block a user