mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-15 03:01:39 +00:00
fix(hub): repair v24 migration test fixture
This commit is contained in:
@@ -64,6 +64,9 @@ describe('schema migration v23 to v26', () => {
|
||||
new Store(dbPath).close()
|
||||
const legacy = new Database(dbPath)
|
||||
legacy.exec(`
|
||||
-- V26/V27 indexes depend on delivery_state and did not exist in V24.
|
||||
DROP INDEX idx_messages_immediate_queued;
|
||||
DROP INDEX idx_messages_future_scheduled_queued;
|
||||
ALTER TABLE messages DROP COLUMN delivery_state;
|
||||
PRAGMA user_version = 24;
|
||||
`)
|
||||
@@ -73,8 +76,13 @@ describe('schema migration v23 to v26', () => {
|
||||
const internalDb = (migrated as unknown as { db: Database }).db
|
||||
const columns = internalDb.prepare('PRAGMA table_info(messages)').all() as Array<{ name: string }>
|
||||
const version = internalDb.prepare('PRAGMA user_version').get() as { user_version: number }
|
||||
const indexes = internalDb.prepare('PRAGMA index_list(messages)').all() as Array<{ name: string }>
|
||||
expect(columns.some((col) => col.name === 'delivery_state')).toBe(true)
|
||||
expect(version.user_version).toBe(28)
|
||||
expect(indexes.map((index) => index.name)).toEqual(expect.arrayContaining([
|
||||
'idx_messages_immediate_queued',
|
||||
'idx_messages_future_scheduled_queued'
|
||||
]))
|
||||
migrated.close()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user