| 170 | * Get migration history from database |
| 171 | */ |
| 172 | export function getMigrationHistory( |
| 173 | db: SqliteDatabase |
| 174 | ): Array<{ version: number; appliedAt: number; description: string | null }> { |
| 175 | const rows = db |
| 176 | .prepare('SELECT version, applied_at, description FROM schema_versions ORDER BY version') |
| 177 | .all() as Array<{ version: number; applied_at: number; description: string | null }>; |
| 178 | |
| 179 | return rows.map((row) => ({ |
| 180 | version: row.version, |
| 181 | appliedAt: row.applied_at, |
| 182 | description: row.description, |
| 183 | })); |
| 184 | } |