From fd1b29e7efc7613ccfb0c5312ed77f4eba522d08 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 15 Dec 2023 16:47:44 +0100 Subject: [PATCH] [backend/web-api] Fix session table migration --- .../backend/src/migration/1702326649645-add-session-table.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/backend/src/migration/1702326649645-add-session-table.ts b/packages/backend/src/migration/1702326649645-add-session-table.ts index d5ed0fef1..1051f41d3 100644 --- a/packages/backend/src/migration/1702326649645-add-session-table.ts +++ b/packages/backend/src/migration/1702326649645-add-session-table.ts @@ -4,18 +4,14 @@ export class AddSessionTable1702326649645 implements MigrationInterface { name = 'AddSessionTable1702326649645' public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "public"."IDX_0ee0c7254e5612a8129251997e"`); await queryRunner.query(`CREATE TABLE "session" ("id" character varying(32) NOT NULL, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "userId" character varying(32) NOT NULL, "token" character varying(64) NOT NULL, "active" boolean NOT NULL, CONSTRAINT "PK_f55da76ac1c3ac420f444d2ff11" PRIMARY KEY ("id")); COMMENT ON COLUMN "session"."createdAt" IS 'The created date of the OAuth token'; COMMENT ON COLUMN "session"."token" IS 'The authorization token'; COMMENT ON COLUMN "session"."active" IS 'Whether or not the token has been activated (i.e. 2fa has been confirmed)'`); await queryRunner.query(`CREATE INDEX "IDX_232f8e85d7633bd6ddfad42169" ON "session" ("token") `); - await queryRunner.query(`ALTER TABLE "notification" DROP COLUMN "mastoId"`); await queryRunner.query(`ALTER TABLE "session" ADD CONSTRAINT "FK_3d2f174ef04fb312fdebd0ddc53" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(`ALTER TABLE "session" DROP CONSTRAINT "FK_3d2f174ef04fb312fdebd0ddc53"`); - await queryRunner.query(`ALTER TABLE "notification" ADD "mastoId" SERIAL NOT NULL`); await queryRunner.query(`DROP INDEX "public"."IDX_232f8e85d7633bd6ddfad42169"`); await queryRunner.query(`DROP TABLE "session"`); - await queryRunner.query(`CREATE UNIQUE INDEX "IDX_0ee0c7254e5612a8129251997e" ON "notification" ("mastoId") `); } }