Raw
1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20240602110946 extends Migration {
4 async up(): Promise<void> {
5 this.addSql(
6 'ALTER TABLE IF EXISTS "customer_group" ALTER COLUMN "name" SET NOT NULL;'
7 )
8 this.addSql(
9 'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_group_name_unique" ON "customer_group" (name) WHERE deleted_at IS NULL;'
10 )
11 }
12
13 async down(): Promise<void> {
14 this.addSql(
15 'ALTER TABLE IF EXISTS "customer_group" ALTER COLUMN "name" DROP NOT NULL;'
16 )
17 this.addSql('drop index if exists "IDX_customer_group_name_unique";')
18 }
19 }