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