import { Migration } from "@mikro-orm/migrations";
class Migration20260411203200 extends Migration {
  async up() {
    this.addSql(`delete from "role_acls" where "role_id" in (select "id" from "roles" where "tenant_id" is null);`);
    this.addSql(`delete from "user_roles" where "role_id" in (select "id" from "roles" where "tenant_id" is null);`);
    this.addSql(`delete from "role_sidebar_preferences" where "role_id" in (select "id" from "roles" where "tenant_id" is null);`);
    this.addSql(`delete from "roles" where "tenant_id" is null;`);
    this.addSql(`alter table "roles" alter column "tenant_id" drop default;`);
    this.addSql(`alter table "roles" alter column "tenant_id" type uuid using ("tenant_id"::text::uuid);`);
    this.addSql(`alter table "roles" alter column "tenant_id" set not null;`);
  }
  async down() {
    this.addSql(`alter table "roles" alter column "tenant_id" drop default;`);
    this.addSql(`alter table "roles" alter column "tenant_id" type uuid using ("tenant_id"::text::uuid);`);
    this.addSql(`alter table "roles" alter column "tenant_id" drop not null;`);
  }
}
export {
  Migration20260411203200
};
//# sourceMappingURL=Migration20260411203200.js.map
