import { MigrationInterface, QueryRunner } from 'typeorm'; export class createPasswordResetTokens1588008410195 implements MigrationInterface { name = 'createPasswordResetTokens1588008410195'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query( `CREATE TABLE "password_reset_token" ("id" SERIAL NOT NULL, "token" uuid NOT NULL DEFAULT uuid_generate_v4(), "isUsed" boolean NOT NULL DEFAULT false, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP, "version" integer NOT NULL, "userId" integer, CONSTRAINT "PK_838af121380dfe3a6330e04f5bb" PRIMARY KEY ("id"))`, undefined, ); await queryRunner.query( `ALTER TABLE "password_reset_token" ADD CONSTRAINT "FK_a4e53583f7a8ab7d01cded46a41" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, undefined, ); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query( `ALTER TABLE "password_reset_token" DROP CONSTRAINT "FK_a4e53583f7a8ab7d01cded46a41"`, undefined, ); await queryRunner.query(`DROP TABLE "password_reset_token"`, undefined); } }