1 import { Migration } from "@medusajs/framework/mikro-orm/migrations"
2
3 export class Migration20251218140235 extends Migration {
4 override async up(): Promise<void> {
5 this.addSql(
6 `alter table if exists "translation_settings" drop constraint if exists "translation_settings_entity_type_unique";`
7 )
8 this.addSql(
9 `create table if not exists "translation_settings" ("id" text not null, "entity_type" text not null, "fields" jsonb not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "translation_settings_pkey" primary key ("id"));`
10 )
11 this.addSql(
12 `CREATE INDEX IF NOT EXISTS "IDX_translation_settings_deleted_at" ON "translation_settings" ("deleted_at") WHERE deleted_at IS NULL;`
13 )
14 this.addSql(
15 `CREATE UNIQUE INDEX IF NOT EXISTS "IDX_translation_settings_entity_type_unique" ON "translation_settings" ("entity_type") WHERE deleted_at IS NULL;`
16 )
17 }
18
19 override async down(): Promise<void> {
20 this.addSql(`drop table if exists "translation_settings" cascade;`)
21 }
22 }