1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20240621145944 extends Migration {
4 async up(): Promise<void> {
5 this.addSql(
6 'create table if not exists "store_currency" ("id" text not null, "currency_code" text not null, "is_default" boolean not null default false, "store_id" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "store_currency_pkey" primary key ("id"));'
7 )
8 this.addSql(
9 'CREATE INDEX IF NOT EXISTS "IDX_store_currency_deleted_at" ON "store_currency" (deleted_at) WHERE deleted_at IS NOT NULL;'
10 )
11 this.addSql(
12 'alter table if exists "store_currency" add constraint "store_currency_store_id_foreign" foreign key ("store_id") references "store" ("id") on update cascade on delete cascade;'
13 )
14 this.addSql(
15 'alter table if exists "store" drop column if exists "supported_currency_codes";'
16 )
17 this.addSql(
18 'alter table if exists "store" drop column if exists "default_currency_code";'
19 )
20 }
21 }