Migration summary

This commit is contained in:
Konstantin Wohlwend 2025-08-25 10:13:18 -07:00
parent 8bf20d0f65
commit 914942dd2f
2 changed files with 33 additions and 2 deletions

View File

@ -77,6 +77,7 @@ To see all development ports, refer to the index.html of `apps/dev-launchpad/pub
### Code-related
- Use ES6 maps instead of records wherever you can.
- Use `performance.now()` where appropriate for timing deltas, not `Date.now()`
### Testing-related
- When writing tests, prefer .toMatchInlineSnapshot over other matchers, if possible. You can check (and modify) the snapshot-serializer.ts file to see how the snapshots are formatted and how non-deterministic values are handled.

View File

@ -34,12 +34,42 @@ const promptDropDb = async () => {
};
const migrate = async () => {
await applyMigrations({
const startTime = performance.now();
const migrationFiles = getMigrationFiles(MIGRATION_FILES_DIR);
const totalMigrations = migrationFiles.length;
const result = await applyMigrations({
prismaClient: globalPrismaClient,
migrationFiles: getMigrationFiles(MIGRATION_FILES_DIR),
migrationFiles,
logging: true,
schema: globalPrismaSchema,
});
const endTime = performance.now();
const duration = ((endTime - startTime) / 1000).toFixed(2);
// Print summary
console.log('\n' + '='.repeat(60));
console.log('📊 MIGRATION SUMMARY');
console.log('='.repeat(60));
console.log(`✅ Migrations completed successfully`);
console.log(`⏱️ Duration: ${duration} seconds`);
console.log(`📁 Total migrations in folder: ${totalMigrations}`);
console.log(`🆕 Newly applied migrations: ${result.newlyAppliedMigrationNames.length}`);
console.log(`✓ Already applied migrations: ${totalMigrations - result.newlyAppliedMigrationNames.length}`);
if (result.newlyAppliedMigrationNames.length > 0) {
console.log('\n📝 Newly applied migrations:');
result.newlyAppliedMigrationNames.forEach((name, index) => {
console.log(` ${index + 1}. ${name}`);
});
} else {
console.log('\n✨ Database is already up to date!');
}
console.log('='.repeat(60) + '\n');
return result;
};
const showHelp = () => {