import { BaseMigration } from './base-migration.ts';
import type { TQueryFunction } from '../types.ts';

export class Migration004RegistryColumns extends BaseMigration {
  readonly version = 4;
  readonly description = 'Add Onebox Registry columns to services table';

  up(query: TQueryFunction): void {
    query(`ALTER TABLE services ADD COLUMN use_onebox_registry INTEGER DEFAULT 0`);
    query(`ALTER TABLE services ADD COLUMN registry_repository TEXT`);
    query(`ALTER TABLE services ADD COLUMN registry_token TEXT`);
    query(`ALTER TABLE services ADD COLUMN registry_image_tag TEXT DEFAULT 'latest'`);
    query(`ALTER TABLE services ADD COLUMN auto_update_on_push INTEGER DEFAULT 0`);
    query(`ALTER TABLE services ADD COLUMN image_digest TEXT`);
  }
}
