|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20240624153824 extends Migration { |
|
4
|
async up(): Promise<void> { |
|
5
|
this.addSql( |
|
6
|
'alter table if exists "promotion_campaign" drop constraint if exists "IDX_campaign_identifier_unique";' |
|
7
|
) |
|
8
|
this.addSql( |
|
9
|
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_promotion_campaign_campaign_identifier_unique" ON "promotion_campaign" (campaign_identifier) WHERE deleted_at IS NULL;' |
|
10
|
) |
|
11
|
} |
|
12
|
|
|
13
|
async down(): Promise<void> { |
|
14
|
this.addSql( |
|
15
|
'drop index if exists "IDX_promotion_campaign_campaign_identifier_unique";' |
|
16
|
) |
|
17
|
this.addSql( |
|
18
|
'alter table if exists "promotion_campaign" add constraint "IDX_campaign_identifier_unique" unique ("campaign_identifier");' |
|
19
|
) |
|
20
|
} |
|
21
|
} |