|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations" |
|
2
|
|
|
3
|
export class Migration20250128132404 extends Migration { |
|
4
|
override async up(): Promise<void> { |
|
5
|
this.addSql( |
|
6
|
`create table if not exists "index_sync" ("id" text not null, "entity" text not null, "last_key" text null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "index_sync_pkey" primary key ("id"));` |
|
7
|
) |
|
8
|
this.addSql( |
|
9
|
`CREATE INDEX IF NOT EXISTS "IDX_index_sync_deleted_at" ON "index_sync" (deleted_at) WHERE deleted_at IS NULL;` |
|
10
|
) |
|
11
|
this.addSql( |
|
12
|
`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_index_sync_entity" ON "index_sync" (entity) WHERE deleted_at IS NULL;` |
|
13
|
) |
|
14
|
} |
|
15
|
|
|
16
|
override async down(): Promise<void> { |
|
17
|
this.addSql(`drop table if exists "index_sync" cascade;`) |
|
18
|
} |
|
19
|
} |