This commit is contained in:
2026-02-21 16:35:45 +03:30
parent 221e949f32
commit 408290bf5a
7 changed files with 51 additions and 91 deletions
@@ -0,0 +1,20 @@
import { Migration } from '@mikro-orm/migrations';
export class Migration20260221130421 extends Migration {
override async up(): Promise<void> {
this.addSql(`alter table "orders" drop constraint "orders_type_id_foreign";`);
this.addSql(`alter table "orders" add column "printery" varchar(255) null, add column "lithography" varchar(255) null;`);
this.addSql(`alter table "orders" add constraint "orders_type_id_foreign" foreign key ("type_id") references "categories" ("id") on update cascade;`);
}
override async down(): Promise<void> {
this.addSql(`create table "order_types" ("id" char(26) not null, "created_at" timestamptz not null default now(), "deleted_at" timestamptz null, "title" varchar(255) not null, constraint "order_types_pkey" primary key ("id"));`);
this.addSql(`alter table "orders" drop constraint "orders_type_id_foreign";`);
this.addSql(`alter table "orders" add constraint "orders_type_id_foreign" foreign key ("type_id") references "order_types" ("id") on update cascade;`);
}
}