1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20240628075401 extends Migration {
4 async up(): Promise<void> {
5 this.addSql(
6 'alter table if exists "notification_provider" add column if not exists "created_at" timestamptz not null default now(), add column "updated_at" timestamptz not null default now(), add column "deleted_at" timestamptz null;'
7 )
8 this.addSql(
9 'alter table if exists "notification_provider" alter column "channels" type text[] using ("channels"::text[]);'
10 )
11 this.addSql(
12 'alter table if exists "notification_provider" alter column "channels" set default \'{}\';'
13 )
14
15 this.addSql(
16 'alter table if exists "notification" add column if not exists "updated_at" timestamptz not null default now(), add column "deleted_at" timestamptz null;'
17 )
18 this.addSql('drop index if exists "IDX_notification_idempotency_key";')
19 this.addSql(
20 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_notification_idempotency_key_unique" ON "notification" (idempotency_key) WHERE deleted_at IS NULL;'
21 )
22 }
23 }