diff --git a/.env b/.env index aec3820..644cfcd 100644 --- a/.env +++ b/.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 diff --git a/package-lock.json b/package-lock.json index 4ee0a21..80f6e9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index 6443677..687af1d 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/scripts/add-reminder-times.cjs b/scripts/add-reminder-times.cjs new file mode 100644 index 0000000..f14655a --- /dev/null +++ b/scripts/add-reminder-times.cjs @@ -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);