try to fix order migration again
This commit is contained in:
29
src/database/migrations/Migration20260108142003.ts
Normal file
29
src/database/migrations/Migration20260108142003.ts
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { Migration } from "@mikro-orm/migrations";
|
||||||
|
|
||||||
|
export class Migration20260108142003 extends Migration {
|
||||||
|
override async up(): Promise<void> {
|
||||||
|
const knex = this.getKnex();
|
||||||
|
|
||||||
|
await knex.schema.createTable("order", (table) => {
|
||||||
|
table.dropForeign("package_id", "order_package_id_foreign");
|
||||||
|
table
|
||||||
|
.foreign("package_id", "order_package_id_foreign")
|
||||||
|
.references("package_detail.id")
|
||||||
|
.onUpdate("NO ACTION")
|
||||||
|
.onDelete("CASCADE");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
override async down(): Promise<void> {
|
||||||
|
const knex = this.getKnex();
|
||||||
|
|
||||||
|
await knex.schema.createTable("order", (table) => {
|
||||||
|
table.dropForeign("package_id", "order_package_id_foreign");
|
||||||
|
table
|
||||||
|
.foreign("package_id", "order_package_id_foreign")
|
||||||
|
.references("package.id")
|
||||||
|
.onUpdate("NO ACTION")
|
||||||
|
.onDelete("CASCADE");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user