Verify legacy migration completion
This commit is contained in:
@@ -6,8 +6,9 @@ import { LegacyConsumerMigrationService } from "../src/domain/services/legacy-co
|
||||
|
||||
const projectRepository = new ProjectRepository();
|
||||
const circuitListRepository = new CircuitListRepository();
|
||||
const migrationRepository = new LegacyConsumerMigrationRepository(db);
|
||||
const migrationService = new LegacyConsumerMigrationService(
|
||||
new LegacyConsumerMigrationRepository(db)
|
||||
migrationRepository
|
||||
);
|
||||
|
||||
async function run() {
|
||||
@@ -30,8 +31,21 @@ async function run() {
|
||||
}
|
||||
}
|
||||
|
||||
const unmigratedConsumers =
|
||||
await migrationRepository.listUnmigratedConsumers();
|
||||
if (unmigratedConsumers.length > 0) {
|
||||
const withoutCircuitList = unmigratedConsumers.filter(
|
||||
(consumer) => !consumer.circuitListId
|
||||
).length;
|
||||
throw new Error(
|
||||
`Cutover verification failed: ${unmigratedConsumers.length} legacy consumer(s) remain unmigrated` +
|
||||
` (${withoutCircuitList} without a circuit list).`
|
||||
);
|
||||
}
|
||||
|
||||
console.log("Legacy consumer migration summary:");
|
||||
console.table(reports);
|
||||
console.log("Cutover verification passed: all legacy consumers are mapped.");
|
||||
}
|
||||
|
||||
run().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user