diff --git a/lib/__tests__/video-transcode-deploy-drain.test.ts b/lib/__tests__/video-transcode-deploy-drain.test.ts index d345fd7..fbaebd3 100644 --- a/lib/__tests__/video-transcode-deploy-drain.test.ts +++ b/lib/__tests__/video-transcode-deploy-drain.test.ts @@ -583,6 +583,7 @@ ${helper}` expect(script).toContain('token.data_type === "text" && token.is_nullable === "YES"') expect(script).toContain('expires.data_type === "timestamp without time zone" && expires.is_nullable === "YES"') expect(script).toContain('String(migrations[0].checksum || "") === sourceChecksum') + expect(script).toContain('readFileSync(migrationPath, "utf8").replace(/\\r\\n/g, "\\n")') expect(script).toContain('!/\\bUNIQUE\\b|\\bWHERE\\b\/i.test(indexDefinition)') expect(script).toContain('!columnsOk || !indexOk || !migrationOk') expect(script).toContain('traffic was not switched') diff --git a/scripts/git-incremental-deploy.ps1 b/scripts/git-incremental-deploy.ps1 index cf307db..f197266 100644 --- a/scripts/git-incremental-deploy.ps1 +++ b/scripts/git-incremental-deploy.ps1 @@ -2674,7 +2674,11 @@ const p = new PrismaClient(); const migrationName = "20260812_add_product_package_upload_job_lease"; const migrationPath = `/app/prisma/migrations/${migrationName}/migration.sql`; let sourceChecksum = ""; -try { sourceChecksum = createHash("sha256").update(readFileSync(migrationPath)).digest("hex"); } +try { + sourceChecksum = createHash("sha256") + .update(readFileSync(migrationPath, "utf8").replace(/\r\n/g, "\n"), "utf8") + .digest("hex"); +} catch (error) { process.stderr.write(String(error && error.message || error)); process.exit(1); } Promise.all([ p.$queryRawUnsafe("SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = $1 AND column_name IN ($2, $3, $4)", "product_package_upload_jobs", "worker_id", "lease_token", "lease_expires_at"), @@ -2718,7 +2722,11 @@ const p = new PrismaClient(); const migrationName = "20260811_add_video_transcode_lease"; const migrationPath = `/app/prisma/migrations/${migrationName}/migration.sql`; let sourceChecksum = ""; -try { sourceChecksum = createHash("sha256").update(readFileSync(migrationPath)).digest("hex"); } +try { + sourceChecksum = createHash("sha256") + .update(readFileSync(migrationPath, "utf8").replace(/\r\n/g, "\n"), "utf8") + .digest("hex"); +} catch (error) { process.stderr.write(String(error && error.message || error)); process.exit(1); } Promise.all([ p.$queryRawUnsafe("SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = $1 AND column_name IN ($2, $3)", "materials", "transcode_lease_token", "transcode_lease_expires_at"), @@ -2818,7 +2826,7 @@ const p = new PrismaClient(); const historicalMigrationName = "20251118000000_add_upload_id_to_materials"; const normalizationMigrationName = "20260812_align_material_upload_idempotency_index"; const migrationChecksum = (name) => createHash("sha256") - .update(readFileSync(`/app/prisma/migrations/${name}/migration.sql`)) + .update(readFileSync(`/app/prisma/migrations/${name}/migration.sql`, "utf8").replace(/\r\n/g, "\n"), "utf8") .digest("hex"); let historicalSourceChecksum = ""; let normalizationSourceChecksum = "";