|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations"; |
|
2
|
|
|
3
|
export class Migration20260616075929 extends Migration { |
|
4
|
|
|
5
|
override async up(): Promise<void> { |
|
6
|
this.addSql(`create table if not exists "auth_verification" ("id" text not null, "auth_identity_id" text not null, "entity_id" text not null, "entity_type" text not null, "code_provider" text not null, "verified_at" timestamptz null, "requested_at" timestamptz not null, "provider_metadata" jsonb null, "metadata" jsonb null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "auth_verification_pkey" primary key ("id"));`); |
|
7
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_verification_auth_identity_id" ON "auth_verification" ("auth_identity_id") WHERE deleted_at IS NULL;`); |
|
8
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_verification_deleted_at" ON "auth_verification" ("deleted_at") WHERE deleted_at IS NULL;`); |
|
9
|
this.addSql(`CREATE UNIQUE INDEX IF NOT EXISTS "IDX_auth_verification_unique_auth_identity_entity_id_entity_type" ON "auth_verification" ("auth_identity_id", "entity_id", "entity_type") WHERE deleted_at IS NULL;`); |
|
10
|
|
|
11
|
this.addSql(`alter table if exists "auth_verification" add constraint "auth_verification_auth_identity_id_foreign" foreign key ("auth_identity_id") references "auth_identity" ("id") on update cascade on delete cascade;`); |
|
12
|
this.addSql(`drop table if exists "auth_verification_token" cascade;`); |
|
13
|
} |
|
14
|
|
|
15
|
override async down(): Promise<void> { |
|
16
|
this.addSql(`drop table if exists "auth_verification" cascade;`); |
|
17
|
} |
|
18
|
|
|
19
|
} |