2025-12-11 10:40:55 +01:00
|
|
|
/*
|
2026-01-12 15:00:36 +01:00
|
|
|
* Copyright (c) 2026 by Christian Kellner.
|
2025-12-11 10:40:55 +01:00
|
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2025-09-18 15:38:23 +02:00
|
|
|
// Initial migration: creates schema_migrations table used by the migration runner.
|
|
|
|
|
//
|
|
|
|
|
export function up(db) {
|
|
|
|
|
db.exec(`
|
|
|
|
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
|
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
name TEXT NOT NULL UNIQUE,
|
|
|
|
|
checksum TEXT NOT NULL,
|
|
|
|
|
applied_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
|
|
|
duration_ms INTEGER NOT NULL DEFAULT 0
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_schema_migrations_applied_at
|
|
|
|
|
ON schema_migrations(applied_at);
|
|
|
|
|
`);
|
|
|
|
|
}
|