...
1ALTER TABLE "identity_recovery_tokens" ADD COLUMN "expires_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00';
2ALTER TABLE "identity_recovery_tokens" ADD COLUMN "issued_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00';
3DROP INDEX IF EXISTS "identity_recovery_addresses_code_idx";
4DROP INDEX IF EXISTS "identity_recovery_addresses_code_uq_idx";
5CREATE TABLE "_identity_recovery_tokens_tmp" (
6"id" TEXT PRIMARY KEY,
7"token" TEXT NOT NULL,
8"used" bool NOT NULL DEFAULT 'false',
9"used_at" DATETIME,
10"identity_recovery_address_id" char(36) NOT NULL,
11"selfservice_recovery_flow_id" char(36),
12"created_at" DATETIME NOT NULL,
13"updated_at" DATETIME NOT NULL,
14"expires_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00',
15"issued_at" DATETIME NOT NULL DEFAULT '2000-01-01 00:00:00',
16FOREIGN KEY (selfservice_recovery_flow_id) REFERENCES selfservice_recovery_flows (id) ON UPDATE NO ACTION ON DELETE CASCADE,
17FOREIGN KEY (identity_recovery_address_id) REFERENCES identity_recovery_addresses (id) ON UPDATE NO ACTION ON DELETE CASCADE
18);
19CREATE INDEX "identity_recovery_addresses_code_idx" ON "_identity_recovery_tokens_tmp" (token);
20CREATE UNIQUE INDEX "identity_recovery_addresses_code_uq_idx" ON "_identity_recovery_tokens_tmp" (token);
21INSERT INTO "_identity_recovery_tokens_tmp" (id, token, used, used_at, identity_recovery_address_id, selfservice_recovery_flow_id, created_at, updated_at, expires_at, issued_at) SELECT id, token, used, used_at, identity_recovery_address_id, selfservice_recovery_flow_id, created_at, updated_at, expires_at, issued_at FROM "identity_recovery_tokens";
22DROP TABLE "identity_recovery_tokens";
23ALTER TABLE "_identity_recovery_tokens_tmp" RENAME TO "identity_recovery_tokens";
View as plain text