import { Migration } from "@mikro-orm/migrations";
class Migration20260531120000_communication_channels extends Migration {
  up() {
    this.addSql(`drop index if exists "channel_thread_tokens_thread_idx";`);
    this.addSql(`alter table "channel_thread_tokens" add constraint "channel_thread_tokens_thread_uq" unique ("tenant_id", "message_thread_id");`);
    this.addSql(`create unique index "communication_channels_user_provider_external_uq" on "communication_channels" ("tenant_id", "user_id", "provider_key", "external_identifier") where "deleted_at" is null and "user_id" is not null and "external_identifier" is not null;`);
  }
  down() {
    this.addSql(`drop index if exists "communication_channels_user_provider_external_uq";`);
    this.addSql(`alter table "channel_thread_tokens" drop constraint if exists "channel_thread_tokens_thread_uq";`);
    this.addSql(`create index "channel_thread_tokens_thread_idx" on "channel_thread_tokens" ("message_thread_id", "tenant_id");`);
  }
}
export {
  Migration20260531120000_communication_channels
};
//# sourceMappingURL=Migration20260531120000_communication_channels.js.map
