Skip to content

Commit

Permalink
fix(system-api): fix executed migrations query when running on old sc…
Browse files Browse the repository at this point in the history
…hema [fixes #523]
  • Loading branch information
matej21 committed Mar 20, 2024
1 parent f6019f1 commit bd56721
Showing 1 changed file with 3 additions and 8 deletions.
@@ -1,16 +1,11 @@
import { SelectBuilder } from '@contember/database'
import { Literal, SelectBuilder } from '@contember/database'
import { ExecutedMigration } from '../../dtos'
import { VERSION_INITIAL } from '@contember/schema-migrations'

type ExecutedMigrationRow = { id: number; name: string; migration: any; checksum: string | null; executed_at: Date; type: 'content' | 'schema' }
export const createExecutedMigrationQueryBuilder = () =>
SelectBuilder.create<ExecutedMigrationRow>()
.select('id')
.select('name')
.select('migration')
.select('checksum')
.select('executed_at')
.select('type')
.select(new Literal('*'))
.from('schema_migration')
.orderBy('version')

Expand All @@ -22,5 +17,5 @@ export const createExecutedMigrationDto = (row: ExecutedMigrationRow) =>
row.migration.modifications,
row.executed_at,
row.checksum,
row.type,
row.type ?? 'schema',
)

0 comments on commit bd56721

Please sign in to comment.