|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20240322120125 extends Migration { |
|
4
|
async up(): Promise<void> { |
|
5
|
this.addSql('drop index if exists "IDX_price_rule_price_id_unique";') |
|
6
|
this.addSql( |
|
7
|
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_rule_type_id_unique" ON "price_rule" (price_id, rule_type_id) WHERE deleted_at IS NULL;' |
|
8
|
) |
|
9
|
} |
|
10
|
|
|
11
|
async down(): Promise<void> { |
|
12
|
this.addSql( |
|
13
|
'drop index if exists "IDX_price_rule_price_id_rule_type_id_unique";' |
|
14
|
) |
|
15
|
this.addSql( |
|
16
|
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_unique" ON "price_rule" (price_id) WHERE deleted_at IS NULL;' |
|
17
|
) |
|
18
|
} |
|
19
|
} |