remove unused

This commit is contained in:
2026-03-09 16:11:57 +03:30
parent 59dc8be0e7
commit 8f833b5677
37 changed files with 26 additions and 11247 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,27 +0,0 @@
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 (''));`);
}
}
@@ -1,23 +0,0 @@
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;`);
}
}
@@ -1,14 +0,0 @@
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";`);
}
}
@@ -1,19 +0,0 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260226063544 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "deliveries" alter column "delivery_fee" type int using ("delivery_fee"::int);`);
this.addSql(`alter table "deliveries" alter column "per_kilometer_fee" type int using ("per_kilometer_fee"::int);`);
this.addSql(`alter table "deliveries" alter column "distance_based_min_cost" type int using ("distance_based_min_cost"::int);`);
this.addSql(`alter table "deliveries" alter column "min_order_price" type int using ("min_order_price"::int);`);
}
override async down(): Promise<void> {
this.addSql(`alter table "deliveries" alter column "delivery_fee" type numeric(10,0) using ("delivery_fee"::numeric(10,0));`);
this.addSql(`alter table "deliveries" alter column "per_kilometer_fee" type numeric(10,0) using ("per_kilometer_fee"::numeric(10,0));`);
this.addSql(`alter table "deliveries" alter column "distance_based_min_cost" type numeric(10,0) using ("distance_based_min_cost"::numeric(10,0));`);
this.addSql(`alter table "deliveries" alter column "min_order_price" type numeric(10,0) using ("min_order_price"::numeric(10,0));`);
}
}
@@ -1,94 +0,0 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260309112630 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 "point_transactions" add constraint "point_transactions_type_check" check("type" in (''));`);
}
override async down(): Promise<void> {
this.addSql(`create table "icon_groups" ("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, "name" varchar(255) not null, constraint "icon_groups_pkey" primary key ("id"));`);
this.addSql(`create index "icon_groups_created_at_index" on "icon_groups" ("created_at");`);
this.addSql(`create index "icon_groups_deleted_at_index" on "icon_groups" ("deleted_at");`);
this.addSql(`create table "icons" ("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, "url" varchar(255) not null, "group_id" char(26) not null, constraint "icons_pkey" primary key ("id"));`);
this.addSql(`create index "icons_created_at_index" on "icons" ("created_at");`);
this.addSql(`create index "icons_deleted_at_index" on "icons" ("deleted_at");`);
this.addSql(`create index "icons_group_id_index" on "icons" ("group_id");`);
this.addSql(`create table "inventory" ("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, "food_id" char(26) null, "total_stock" int4 not null, "available_stock" int4 not null, constraint "inventory_pkey" primary key ("id"));`);
this.addSql(`create index "inventory_created_at_index" on "inventory" ("created_at");`);
this.addSql(`create index "inventory_deleted_at_index" on "inventory" ("deleted_at");`);
this.addSql(`alter table "inventory" add constraint "inventory_food_id_unique" unique ("food_id");`);
this.addSql(`create table "order_items" ("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, "order_id" char(26) not null, "food_id" char(26) not null, "quantity" int4 not null, "unit_price" numeric(10,0) not null, "discount" numeric(10,0) not null default 0, "total_price" numeric(10,0) not null, constraint "order_items_pkey" primary key ("id"));`);
this.addSql(`create index "order_items_created_at_index" on "order_items" ("created_at");`);
this.addSql(`create index "order_items_deleted_at_index" on "order_items" ("deleted_at");`);
this.addSql(`create index "order_items_food_id_index" on "order_items" ("food_id");`);
this.addSql(`create index "order_items_order_id_index" on "order_items" ("order_id");`);
this.addSql(`create table "orders" ("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, "user_id" char(26) not null, "restaurant_id" char(26) not null, "delivery_method_id" char(26) not null, "user_address" jsonb null, "car_address" jsonb null, "payment_method_id" char(26) not null, "order_number" int4 null, "coupon_discount" numeric(10,0) not null default 0, "coupon_detail" jsonb null, "items_discount" numeric(10,0) not null default 0, "total_discount" numeric(10,0) not null default 0, "sub_total" numeric(10,0) not null, "tax" numeric(10,0) not null default 0, "delivery_fee" numeric(10,0) not null default 0, "total" numeric(10,0) not null, "total_items" int4 not null default 0, "description" text null, "table_number" varchar(255) null, "status" text check ("status" in ('pendingPayment', 'paid', 'preparing', 'deliveredToWaiter', 'deliveredToReceptionist', 'shipped', 'completed', 'canceled')) not null, "history" jsonb null, constraint "orders_pkey" primary key ("id"));`);
this.addSql(`create index "orders_created_at_index" on "orders" ("created_at");`);
this.addSql(`create index "orders_deleted_at_index" on "orders" ("deleted_at");`);
this.addSql(`create index "orders_restaurant_id_order_number_index" on "orders" ("restaurant_id", "order_number");`);
this.addSql(`alter table "orders" add constraint "orders_restaurant_id_order_number_unique" unique ("restaurant_id", "order_number");`);
this.addSql(`create index "orders_restaurant_id_status_index" on "orders" ("restaurant_id", "status");`);
this.addSql(`create index "orders_status_index" on "orders" ("status");`);
this.addSql(`create index "orders_user_id_status_index" on "orders" ("user_id", "status");`);
this.addSql(`create table "pagers" ("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, "cookie_id" varchar(255) not null, "restaurant_id" char(26) not null, "table_number" varchar(255) not null, "user_id" char(26) null, "staff_id" char(26) null, "message" varchar(255) null, "status" text check ("status" in ('pending', 'acknowledged', 'rejected', 'completed')) not null default 'pending', constraint "pagers_pkey" primary key ("id"));`);
this.addSql(`create index "pagers_created_at_index" on "pagers" ("created_at");`);
this.addSql(`create index "pagers_deleted_at_index" on "pagers" ("deleted_at");`);
this.addSql(`create table "payment_methods" ("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, "method" text check ("method" in ('Online', 'Cash', 'Wallet')) not null, "gateway" text check ("gateway" in ('zarinpal')) null, "description" varchar(255) null, "enabled" bool not null default true, "order" int4 not null default 0, "merchant_id" varchar(255) null, constraint "payment_methods_pkey" primary key ("id"));`);
this.addSql(`create index "payment_methods_created_at_index" on "payment_methods" ("created_at");`);
this.addSql(`create index "payment_methods_deleted_at_index" on "payment_methods" ("deleted_at");`);
this.addSql(`create index "payment_methods_restaurant_id_enabled_index" on "payment_methods" ("restaurant_id", "enabled");`);
this.addSql(`alter table "payment_methods" add constraint "payment_methods_restaurant_id_method_unique" unique ("restaurant_id", "method");`);
this.addSql(`create table "payments" ("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, "order_id" char(26) not null, "amount" numeric(10,0) not null, "reference_id" varchar(255) null, "method" text check ("method" in ('Online', 'Cash', 'Wallet')) not null, "gateway" text check ("gateway" in ('zarinpal')) null, "transaction_id" varchar(255) null, "status" text check ("status" in ('pending', 'paid', 'failed', 'refunded')) not null, "card_pan" varchar(255) null, "verify_response" jsonb null, "paid_at" varchar(255) null, "failed_at" varchar(255) null, "description" varchar(255) null, constraint "payments_pkey" primary key ("id"));`);
this.addSql(`create index "payments_created_at_index" on "payments" ("created_at");`);
this.addSql(`create index "payments_deleted_at_index" on "payments" ("deleted_at");`);
this.addSql(`create index "payments_order_id_index" on "payments" ("order_id");`);
this.addSql(`alter table "payments" add constraint "payments_reference_id_unique" unique ("reference_id");`);
this.addSql(`create table "reviews" ("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, "order_id" char(26) not null, "food_id" char(26) not null, "user_id" char(26) not null, "comment" text null, "rating" int4 not null default 0, "positive_points" jsonb null, "negative_points" jsonb null, "status" text check ("status" in ('pending', 'rejected', 'approved')) not null default 'pending', constraint "reviews_pkey" primary key ("id"));`);
this.addSql(`create index "reviews_created_at_index" on "reviews" ("created_at");`);
this.addSql(`create index "reviews_deleted_at_index" on "reviews" ("deleted_at");`);
this.addSql(`create index "reviews_food_id_status_index" on "reviews" ("food_id", "status");`);
this.addSql(`alter table "reviews" add constraint "reviews_order_id_food_id_user_id_unique" unique ("order_id", "food_id", "user_id");`);
this.addSql(`create index "reviews_order_id_index" on "reviews" ("order_id");`);
this.addSql(`create index "reviews_user_id_index" on "reviews" ("user_id");`);
this.addSql(`alter table "icons" add constraint "icons_group_id_foreign" foreign key ("group_id") references "icon_groups" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "inventory" add constraint "inventory_food_id_foreign" foreign key ("food_id") references "foods" ("id") on update cascade on delete cascade;`);
this.addSql(`alter table "order_items" add constraint "order_items_food_id_foreign" foreign key ("food_id") references "foods" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "order_items" add constraint "order_items_order_id_foreign" foreign key ("order_id") references "orders" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "orders" add constraint "orders_delivery_method_id_foreign" foreign key ("delivery_method_id") references "deliveries" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "orders" add constraint "orders_payment_method_id_foreign" foreign key ("payment_method_id") references "payment_methods" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "orders" add constraint "orders_restaurant_id_foreign" foreign key ("restaurant_id") references "restaurants" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "orders" add constraint "orders_user_id_foreign" foreign key ("user_id") references "users" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "pagers" add constraint "pagers_restaurant_id_foreign" foreign key ("restaurant_id") references "restaurants" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "pagers" add constraint "pagers_staff_id_foreign" foreign key ("staff_id") references "admins" ("id") on update cascade on delete set null;`);
this.addSql(`alter table "pagers" add constraint "pagers_user_id_foreign" foreign key ("user_id") references "users" ("id") on update cascade on delete set null;`);
this.addSql(`alter table "payment_methods" add constraint "payment_methods_restaurant_id_foreign" foreign key ("restaurant_id") references "restaurants" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "payments" add constraint "payments_order_id_foreign" foreign key ("order_id") references "orders" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "reviews" add constraint "reviews_food_id_foreign" foreign key ("food_id") references "foods" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "reviews" add constraint "reviews_order_id_foreign" foreign key ("order_id") references "orders" ("id") on update cascade on delete no action;`);
this.addSql(`alter table "reviews" add constraint "reviews_user_id_foreign" foreign key ("user_id") references "users" ("id") on update cascade on delete no action;`);
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 (''));`);
}
}