|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20240704094505 extends Migration { |
|
4
|
async up(): Promise<void> { |
|
5
|
this.addSql( |
|
6
|
'create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));' |
|
7
|
) |
|
8
|
this.addSql( |
|
9
|
'CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;' |
|
10
|
) |
|
11
|
this.addSql( |
|
12
|
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;' |
|
13
|
) |
|
14
|
} |
|
15
|
|
|
16
|
async down(): Promise<void> { |
|
17
|
this.addSql('drop table if exists "price_preference" cascade;') |
|
18
|
} |
|
19
|
} |