Allow undated reconstructed events

This commit is contained in:
2026-08-14 19:57:22 +02:00
parent 703b9652c9
commit d99deb3c06
10 changed files with 60 additions and 17 deletions
+5 -3
View File
@@ -33,7 +33,7 @@ suite('PostgreSQL migrations', () => {
const migrationsDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'migrations')
const firstRun: string[] = []
await runMigrations(testDatabaseUrl, migrationsDir, message => firstRun.push(message))
expect(firstRun.filter(message => message.startsWith('apply '))).toHaveLength(11)
expect(firstRun.filter(message => message.startsWith('apply '))).toHaveLength(12)
const client = new Client({ connectionString: testDatabaseUrl })
await client.connect()
@@ -47,14 +47,16 @@ suite('PostgreSQL migrations', () => {
]))
expect(tableNames).not.toEqual(expect.arrayContaining(['cases', 'widgets', 'widget_relations', 'playthroughs']))
const ledger = await client.query<{ count: string }>('SELECT COUNT(*)::text AS count FROM osint.schema_migrations')
expect(ledger.rows[0].count).toBe('11')
expect(ledger.rows[0].count).toBe('12')
const connectionColumns = await client.query<{ column_name: string }>(`SELECT column_name FROM information_schema.columns WHERE table_schema='osint' AND table_name='exhibit_connections'`)
expect(connectionColumns.rows.map(row => row.column_name)).toEqual(expect.arrayContaining(['label', 'tightness', 'tag_style', 'tag_position_percent', 'tag_lateral_offset']))
const eventOccurrence = await client.query<{ is_nullable: string }>(`SELECT is_nullable FROM information_schema.columns WHERE table_schema='osint' AND table_name='event_exhibits' AND column_name='occurred_at'`)
expect(eventOccurrence.rows[0].is_nullable).toBe('YES')
await client.end()
const secondRun: string[] = []
await runMigrations(testDatabaseUrl, migrationsDir, message => secondRun.push(message))
expect(secondRun.filter(message => message.startsWith('skip '))).toHaveLength(11)
expect(secondRun.filter(message => message.startsWith('skip '))).toHaveLength(12)
expect(secondRun.some(message => message.startsWith('apply '))).toBe(false)
})
})