fix(core): Remove typeorm patches, but still enforce transactions on every migration (#6594)

* revert(core): Remove typeorm patches, but still enforce transactions on every migration

This reverts #6519

* always re-enable foreign keys, and explicitly rollback transaction
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-07-05 11:26:49 +02:00
committed by GitHub
parent 7495e31a5b
commit 9def7a729b
9 changed files with 69 additions and 66 deletions

View File

@@ -1,6 +1,8 @@
import type { MigrationContext, ReversibleMigration } from '@db/types';
export class AddAPIKeyColumn1652905585850 implements ReversibleMigration {
transaction = false as const;
async up({ queryRunner, tablePrefix }: MigrationContext) {
await queryRunner.query(
`CREATE TABLE "temporary_user" ("id" varchar PRIMARY KEY NOT NULL, "email" varchar(255), "firstName" varchar(32), "lastName" varchar(32), "password" varchar, "resetPasswordToken" varchar, "resetPasswordTokenExpiration" integer DEFAULT NULL, "personalizationAnswers" text, "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "globalRoleId" integer NOT NULL, "settings" text, "apiKey" varchar, CONSTRAINT "FK_${tablePrefix}f0609be844f9200ff4365b1bb3d" FOREIGN KEY ("globalRoleId") REFERENCES "${tablePrefix}role" ("id") ON DELETE NO ACTION ON UPDATE NO ACTION)`,