test:Add database migration service with normalization and masking functions

- Implemented `normalizeMigrationInput` to standardize database migration input for sqlite, mysql, and postgres.
- Added `maskConnectionString` to obscure sensitive credentials in connection strings.
- Created comprehensive tests for migration input normalization and connection string masking.
- Established database schema creation logic for multiple dialects (sqlite, mysql, postgres).
- Developed functions for managing database transactions, including begin, commit, and rollback.
- Implemented data insertion logic from backup snapshots into the target database.
This commit is contained in:
cita
2026-03-05 17:38:52 +08:00
parent 0168592c95
commit 283c052fa5
79 changed files with 3410 additions and 1111 deletions
+7
View File
@@ -32,6 +32,10 @@
"start": "node dist/server/index.js",
"db:generate": "drizzle-kit generate",
"db:migrate": "tsx src/server/db/migrate.ts",
"smoke:db": "tsx scripts/dev/db-smoke.ts",
"smoke:db:sqlite": "tsx scripts/dev/db-smoke.ts --db-type sqlite",
"smoke:db:mysql": "tsx scripts/dev/db-smoke.ts --db-type mysql",
"smoke:db:postgres": "tsx scripts/dev/db-smoke.ts --db-type postgres",
"test": "vitest run --root .",
"test:watch": "vitest --root ."
},
@@ -48,8 +52,10 @@
"fastify": "^5.7.4",
"minimatch": "^10.2.4",
"minimist": "^1.2.8",
"mysql2": "^3.15.3",
"node-cron": "^3.0.3",
"nodemailer": "^8.0.1",
"pg": "^8.16.3",
"undici": "^6.20.1"
},
"devDependencies": {
@@ -58,6 +64,7 @@
"@types/node": "^22.10.1",
"@types/node-cron": "^3.0.11",
"@types/nodemailer": "^7.0.11",
"@types/pg": "^8.15.6",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.4",