feat(M01-B): 建立核心迁移与MySQL连接池
This commit is contained in:
@@ -7,9 +7,16 @@ $requiredFiles = @(
|
||||
"backend/.env.example",
|
||||
"backend/src/app.ts",
|
||||
"backend/src/config.ts",
|
||||
"backend/src/db/mysql.ts",
|
||||
"backend/src/routes/health.ts",
|
||||
"backend/src/server.ts",
|
||||
"backend/tests/backend-contract.test.mjs",
|
||||
"backend/tests/migration-contract.test.mjs",
|
||||
"backend/tests/mysql-pool-contract.test.mjs",
|
||||
"database/migrations/2026061601_m01b_core_schema.up.sql",
|
||||
"database/migrations/2026061601_m01b_core_schema.down.sql",
|
||||
"database/migrations/2026061601_m01b_core_schema.verify.sql",
|
||||
"database/seeds/2026061601_m01b_minimal_seed.sql",
|
||||
"deploy/pm2/ecosystem.config.cjs"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ $head = (& git rev-parse HEAD).Trim()
|
||||
$shortHead = (& git rev-parse --short HEAD).Trim()
|
||||
$backendBuild = if (Test-Path "backend/package.json") { "PROJECT_PRESENT_BUILD_NOT_RUN" } else { "SKIPPED_NO_PROJECT" }
|
||||
$adminBuild = if (Test-Path "admin/package.json") { "PROJECT_PRESENT_BUILD_NOT_RUN" } else { "SKIPPED_NO_PROJECT" }
|
||||
$migrationFiles = @(Get-ChildItem -Path "database/migrations" -Filter "*.sql" -File -ErrorAction SilentlyContinue)
|
||||
$databaseMigration = if ($migrationFiles.Count -gt 0) { "PROJECT_PRESENT_MIGRATION_NOT_RUN" } else { "SKIPPED_NO_MIGRATIONS" }
|
||||
|
||||
$rawText = @"
|
||||
{
|
||||
@@ -14,7 +16,7 @@ $rawText = @"
|
||||
"backendBuild": "$backendBuild",
|
||||
"adminBuild": "$adminBuild",
|
||||
"miniappMirror": "RECORDED_SOURCE_COMMIT_ONLY",
|
||||
"databaseMigration": "SKIPPED_NO_MIGRATIONS",
|
||||
"databaseMigration": "$databaseMigration",
|
||||
"deployed": false
|
||||
}
|
||||
"@
|
||||
@@ -55,8 +57,8 @@ if ((-not (Test-Path "admin/package.json")) -and $manifest.adminBuild -ne "SKIPP
|
||||
throw "Dry-run manifest should record missing admin project"
|
||||
}
|
||||
|
||||
if ($manifest.databaseMigration -ne "SKIPPED_NO_MIGRATIONS") {
|
||||
throw "Dry-run manifest should record skipped migrations until migrations exist"
|
||||
if ($manifest.databaseMigration -ne $databaseMigration) {
|
||||
throw "Dry-run manifest databaseMigration mismatch: $($manifest.databaseMigration)"
|
||||
}
|
||||
|
||||
Write-Host "PASS: release manifest dry-run is valid for current HEAD."
|
||||
|
||||
@@ -22,6 +22,13 @@ $requiredPaths = @(
|
||||
"docs/repository-completeness.md",
|
||||
"scripts/dev/windows/check-workspace.ps1",
|
||||
"backend/package-lock.json",
|
||||
"backend/src/db/mysql.ts",
|
||||
"backend/tests/migration-contract.test.mjs",
|
||||
"backend/tests/mysql-pool-contract.test.mjs",
|
||||
"database/migrations/2026061601_m01b_core_schema.up.sql",
|
||||
"database/migrations/2026061601_m01b_core_schema.down.sql",
|
||||
"database/migrations/2026061601_m01b_core_schema.verify.sql",
|
||||
"database/seeds/2026061601_m01b_minimal_seed.sql",
|
||||
"scripts/dev/windows/check-backend.ps1",
|
||||
"scripts/dev/windows/check-reference.ps1",
|
||||
"scripts/dev/windows/check-repo-completeness.ps1",
|
||||
|
||||
@@ -11,7 +11,7 @@ qipai_release_manifest_json() {
|
||||
local repo_dir="$1"
|
||||
local release_id="$2"
|
||||
local deployed="$3"
|
||||
local backend_build admin_build
|
||||
local backend_build admin_build database_migration
|
||||
|
||||
if [ -f "${repo_dir}/backend/package.json" ]; then
|
||||
backend_build="PROJECT_PRESENT_BUILD_NOT_RUN"
|
||||
@@ -25,6 +25,12 @@ qipai_release_manifest_json() {
|
||||
admin_build="SKIPPED_NO_PROJECT"
|
||||
fi
|
||||
|
||||
if find "${repo_dir}/database/migrations" -maxdepth 1 -type f -name '*.sql' | grep -q .; then
|
||||
database_migration="PROJECT_PRESENT_MIGRATION_NOT_RUN"
|
||||
else
|
||||
database_migration="SKIPPED_NO_MIGRATIONS"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
{
|
||||
"releaseId": "${release_id}",
|
||||
@@ -34,7 +40,7 @@ qipai_release_manifest_json() {
|
||||
"backendBuild": "${backend_build}",
|
||||
"adminBuild": "${admin_build}",
|
||||
"miniappMirror": "RECORDED_SOURCE_COMMIT_ONLY",
|
||||
"databaseMigration": "SKIPPED_NO_MIGRATIONS",
|
||||
"databaseMigration": "${database_migration}",
|
||||
"deployed": ${deployed}
|
||||
}
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user