Rework migrations logging

This commit is contained in:
Alex Gleason 2024-08-02 16:31:06 -05:00
parent 975294b8a4
commit 44a61c4a52
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -62,19 +62,19 @@ export class DittoDB {
}), }),
}); });
console.info('Running migrations...'); console.warn('Running migrations...');
const results = await migrator.migrateToLatest(); const { results, error } = await migrator.migrateToLatest();
if (results.error) { if (error) {
console.error(results.error); console.error(error);
Deno.exit(1); Deno.exit(1);
} else { } else {
if (!results.results?.length) { if (!results?.length) {
console.info('Everything up-to-date.'); console.warn('Everything up-to-date.');
} else { } else {
console.info('Migrations finished!'); console.warn('Migrations finished!');
for (const { migrationName, status } of results.results!) { for (const { migrationName, status } of results!) {
console.info(` - ${migrationName}: ${status}`); console.warn(` - ${migrationName}: ${status}`);
} }
} }
} }