const NEW_COLUMNS = [
    { name: 'git_remote_url', ddl: 'ALTER TABLE applications ADD COLUMN git_remote_url TEXT' },
    {
        name: 'cloud_deployment_provider',
        ddl: 'ALTER TABLE applications ADD COLUMN cloud_deployment_provider TEXT',
    },
    {
        name: 'cloud_deployment_status',
        ddl: 'ALTER TABLE applications ADD COLUMN cloud_deployment_status TEXT',
    },
    {
        name: 'cloud_deployment_id',
        ddl: 'ALTER TABLE applications ADD COLUMN cloud_deployment_id TEXT',
    },
    {
        name: 'cloud_deployment_url',
        ddl: 'ALTER TABLE applications ADD COLUMN cloud_deployment_url TEXT',
    },
    {
        name: 'cloud_deployment_error',
        ddl: 'ALTER TABLE applications ADD COLUMN cloud_deployment_error TEXT',
    },
    { name: 'last_deployed_at', ddl: 'ALTER TABLE applications ADD COLUMN last_deployed_at INTEGER' },
];
export async function up({ context: db }) {
    const columns = db.pragma('table_info(applications)');
    const existing = new Set(columns.map((c) => c.name));
    for (const { name, ddl } of NEW_COLUMNS) {
        if (!existing.has(name)) {
            db.exec(ddl);
        }
    }
}
export async function down(_params) {
    // SQLite doesn't support DROP COLUMN before 3.35.0; leave columns in place.
}
