import { SCHEMA_SQL } from "./schema.js";
/**
 * Each migration has a version number, a name, and an `up` function.
 * Migrations are applied in order when the database version is behind.
 */
export const migrations = [
    {
        version: 1,
        name: "initial-schema",
        up(db) {
            db.exec(SCHEMA_SQL);
        },
    },
    {
        version: 2,
        name: "add-terminal-sessions",
        up(db) {
            db.exec(`
        CREATE TABLE IF NOT EXISTS terminal_sessions (
          terminal_id TEXT PRIMARY KEY,
          project_id TEXT NOT NULL REFERENCES projects(project_id) ON DELETE CASCADE,
          pid INTEGER,
          created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
          closed_at DATETIME
        );
        CREATE INDEX IF NOT EXISTS idx_terminal_sessions_project ON terminal_sessions(project_id);
        CREATE INDEX IF NOT EXISTS idx_terminal_sessions_created ON terminal_sessions(created_at);
      `);
        },
    },
];
//# sourceMappingURL=migrations.js.map