This commit is contained in:
2026-02-08 08:50:08 +03:30
commit 8af4936ed0
323 changed files with 92747 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,27 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260105085439 extends Migration {
override async up(): Promise<void> {
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<void> {
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 (''));`);
}
}
@@ -0,0 +1,23 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260106054151 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "restaurants" alter column "subscription_id" type varchar(255) using ("subscription_id"::varchar(255));`);
this.addSql(`alter table "restaurants" alter column "subscription_id" drop not null;`);
this.addSql(`alter table "restaurants" alter column "subscription_end_date" type timestamptz using ("subscription_end_date"::timestamptz);`);
this.addSql(`alter table "restaurants" alter column "subscription_end_date" drop not null;`);
this.addSql(`alter table "restaurants" alter column "subscription_start_date" type timestamptz using ("subscription_start_date"::timestamptz);`);
this.addSql(`alter table "restaurants" alter column "subscription_start_date" drop not null;`);
}
override async down(): Promise<void> {
this.addSql(`alter table "restaurants" alter column "subscription_id" type varchar(255) using ("subscription_id"::varchar(255));`);
this.addSql(`alter table "restaurants" alter column "subscription_id" set not null;`);
this.addSql(`alter table "restaurants" alter column "subscription_end_date" type timestamptz using ("subscription_end_date"::timestamptz);`);
this.addSql(`alter table "restaurants" alter column "subscription_end_date" set not null;`);
this.addSql(`alter table "restaurants" alter column "subscription_start_date" type timestamptz using ("subscription_start_date"::timestamptz);`);
this.addSql(`alter table "restaurants" alter column "subscription_start_date" set not null;`);
}
}
@@ -0,0 +1,14 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260106192946 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "contacts" add column "restaurant_id" char(26) null;`);
this.addSql(`alter table "contacts" add constraint "contacts_restaurant_id_foreign" foreign key ("restaurant_id") references "restaurants" ("id") on update cascade on delete set null;`);
}
override async down(): Promise<void> {
this.addSql(`alter table "contacts" drop constraint "contacts_restaurant_id_foreign";`);
}
}