1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20250127105159 extends Migration {
4 override async up(): Promise<void> {
5 this.addSql(
6 `alter table if exists "index_relation" alter column "id" set not null;`
7 )
8 this.addSql(
9 `alter table if exists "index_relation" add constraint "IDX_index_relation_id_pivot_parent_name_child_name_parent_id_child_id_unique" unique ("parent_id", "child_id", "child_name", "parent_name", "pivot");`
10 )
11 }
12
13 override async down(): Promise<void> {
14 this.addSql(
15 `alter table if exists "index_relation" drop constraint "IDX_index_relation_id_pivot_parent_name_child_name_parent_id_child_id_unique";`
16 )
17 this.addSql(
18 `alter table if exists "index_relation" alter column "id" drop not null;`
19 )
20 }
21 }