1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class InitialSetup20240228133303 extends Migration {
4 async up(): Promise<void> {
5 this.addSql(`
6 create table if not exists "currency"
7 (
8 "code" text not null,
9 "symbol" text not null,
10 "symbol_native" text not null,
11 "decimal_digits" int not null default 0,
12 "rounding" numeric not null default 0,
13 "raw_rounding" jsonb not null,
14 "name" text not null,
15 "created_at" timestamptz NOT NULL DEFAULT now(),
16 "updated_at" timestamptz NOT NULL DEFAULT now(),
17 constraint "currency_pkey" primary key ("code")
18 );
19
20 ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "created_at" TIMESTAMPTZ NOT NULL DEFAULT now();
21 ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "updated_at" TIMESTAMPTZ NULL DEFAULT now();
22
23 ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "decimal_digits" int not null default 0;
24 ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "rounding" numeric not null default 0;
25 ALTER TABLE "currency" ADD COLUMN IF NOT EXISTS "raw_rounding" jsonb;
26 `)
27 }
28 }