|
1
|
import { Migration } from "@medusajs/framework/mikro-orm/migrations"; |
|
2
|
|
|
3
|
export class Migration20260604120000 extends Migration { |
|
4
|
|
|
5
|
override async up(): Promise<void> { |
|
6
|
this.addSql(`create table if not exists "auth_password_reset_token" ("id" text not null, "auth_identity_id" text not null, "provider_identity_id" text not null, "entity_id" text not null, "token_hash" text not null, "expires_at" timestamptz not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "auth_password_reset_token_pkey" primary key ("id"));`); |
|
7
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_password_reset_token_auth_identity_id" ON "auth_password_reset_token" ("auth_identity_id") WHERE deleted_at IS NULL;`); |
|
8
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_password_reset_token_provider_identity_id" ON "auth_password_reset_token" ("provider_identity_id") WHERE deleted_at IS NULL;`); |
|
9
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_password_reset_token_token_hash" ON "auth_password_reset_token" ("token_hash") WHERE deleted_at IS NULL;`); |
|
10
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_password_reset_token_expires_at" ON "auth_password_reset_token" ("expires_at") WHERE deleted_at IS NULL;`); |
|
11
|
this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_auth_password_reset_token_deleted_at" ON "auth_password_reset_token" ("deleted_at") WHERE deleted_at IS NULL;`); |
|
12
|
|
|
13
|
this.addSql(`alter table if exists "auth_password_reset_token" add constraint "auth_password_reset_token_auth_identity_id_foreign" foreign key ("auth_identity_id") references "auth_identity" ("id") on update cascade on delete cascade;`); |
|
14
|
this.addSql(`alter table if exists "auth_password_reset_token" add constraint "auth_password_reset_token_provider_identity_id_foreign" foreign key ("provider_identity_id") references "provider_identity" ("id") on update cascade on delete cascade;`); |
|
15
|
} |
|
16
|
|
|
17
|
override async down(): Promise<void> { |
|
18
|
this.addSql(`drop table if exists "auth_password_reset_token" cascade;`); |
|
19
|
} |
|
20
|
|
|
21
|
} |