import { Migration } from '@mikro-orm/migrations'; export class Migration20260105085439 extends Migration { override async up(): Promise { this.addSql(`alter table "point_transactions" drop constraint if exists "point_transactions_type_check";`); this.addSql(`alter table "categories" add column "order" int null;`); this.addSql(`alter table "point_transactions" add constraint "point_transactions_type_check" check("type" in (''));`); } override async down(): Promise { this.addSql(`create table "user_wallets" ("id" char(26) not null, "created_at" timestamptz(6) not null default now(), "updated_at" timestamptz(6) not null default now(), "deleted_at" timestamptz(6) null, "restaurant_id" char(26) not null, "user_id" char(26) not null, "wallet" int4 not null default 0, "points" int4 not null default 0, constraint "user_wallets_pkey" primary key ("id"));`); this.addSql(`alter table "user_wallets" add constraint "unique_user_restaurant" unique ("user_id", "restaurant_id");`); this.addSql(`create index "user_wallets_created_at_index" on "user_wallets" ("created_at");`); this.addSql(`create index "user_wallets_deleted_at_index" on "user_wallets" ("deleted_at");`); this.addSql(`create index "user_wallets_restaurant_id_index" on "user_wallets" ("restaurant_id");`); this.addSql(`create index "user_wallets_user_id_index" on "user_wallets" ("user_id");`); this.addSql(`create index "user_wallets_user_id_restaurant_id_index" on "user_wallets" ("user_id", "restaurant_id");`); this.addSql(`alter table "point_transactions" drop constraint if exists "point_transactions_type_check";`); this.addSql(`alter table "point_transactions" add constraint "point_transactions_type_check" check("type" in (''));`); } }