#!/usr/bin/env -S node
import type { Contract as End } from '../../snapshots/292afcdd627e8a8dc76bda0fc864fd5c5d338be0d68f611dde95ed99503a9a2c/contract';
import endContract from '../../snapshots/292afcdd627e8a8dc76bda0fc864fd5c5d338be0d68f611dde95ed99503a9a2c/contract.json' with { type: 'json' };
import type { Contract as Start } from '../../snapshots/d3b1daffc0e3cba04e97760827357421120696a3ee3461c8beff93a92e3cf27d/contract';
import startContract from '../../snapshots/d3b1daffc0e3cba04e97760827357421120696a3ee3461c8beff93a92e3cf27d/contract.json' with { type: 'json' };
import { Migration, MigrationCLI, col } from '@prisma/orm-postgres/migration';

export default class M extends Migration<Start, End> {
  override readonly startContractJson = startContract;
  override readonly endContractJson = endContract;

  override get operations() {
    return [
      this.addColumn({
        schema: 'public',
        table: 'Company',
        column: col('domain', 'text', { codecRef: { codecId: 'pg/text@1' } }),
      }),
      this.addUnique({
        schema: 'public',
        table: 'Company',
        constraint: 'Company_domain_key',
        columns: ['domain'],
      }),
    ];
  }
}

MigrationCLI.run(import.meta.url, M);
