Skip to content

Commit

Permalink
Fix v1 check error showing in postgres logs
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscao633 committed Sep 6, 2023
1 parent acb7fdc commit 0e0788b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/check-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ async function checkDatabaseVersion() {

async function checkV1Tables() {
try {
await prisma.$queryRaw`select * from account limit 1`;

error(
'Umami v1 tables detected. For how to upgrade from v1 to v2 go to https://umami.is/docs/migrate-v1-v2.',
);
process.exit(1);
// check for v1 migrations before v2 release date
const record =
await prisma.$queryRaw`select * from _prisma_migrations where started_at < '2023-04-17'`;

if (record.length > 0) {
error(
'Umami v1 tables detected. For how to upgrade from v1 to v2 go to https://umami.is/docs/migrate-v1-v2.',
);
process.exit(1);
}
} catch (e) {
// Ignore
}
Expand Down

0 comments on commit 0e0788b

Please sign in to comment.