Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ export default async function({

const latest = migrations[migrations.length - 1]

if (latest.migration_id !== migrations.length)
throw new Error('Inconsistency in migration numbering')
if (latest.migration_id !== migrations.length) {
let numbers = []

for (const [i, m] of migrations.entries()) {
if (i === 0 || i + 1 === migrations.length)
continue

if (m.migration_id + 1 !== migrations[i + 1].migration_id)
numbers.push(m.migration_id)
}

throw new Error('Inconsistency in migration numbering at: ' + numbers.map(x => x).join(', '))
}

await ensureMigrationsTable()

Expand Down