import { MigrationInterface, QueryRunner } from 'typeorm'; export class MakePointerColumnsNullable1664280972101 implements MigrationInterface { name = 'MakePointerColumnsNullable1664280972101'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE "retailer_products" DROP CONSTRAINT "FK_87839253e3642f882e0f2225f7a" `); await queryRunner.query(` ALTER TABLE "retailer_products" ALTER COLUMN "aggregateProductId" DROP NOT NULL `); await queryRunner.query(` ALTER TABLE "product_variants" DROP CONSTRAINT "FK_f515690c571a03400a9876600b5" `); await queryRunner.query(` ALTER TABLE "product_variants" ALTER COLUMN "productId" DROP NOT NULL `); await queryRunner.query(` ALTER TABLE "retailer_products" ADD CONSTRAINT "FK_87839253e3642f882e0f2225f7a" FOREIGN KEY ("aggregateProductId") REFERENCES "aggregate_products"("id") ON DELETE NO ACTION ON UPDATE NO ACTION `); await queryRunner.query(` ALTER TABLE "product_variants" ADD CONSTRAINT "FK_f515690c571a03400a9876600b5" FOREIGN KEY ("productId") REFERENCES "aggregate_products"("id") ON DELETE NO ACTION ON UPDATE NO ACTION `); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE "product_variants" DROP CONSTRAINT "FK_f515690c571a03400a9876600b5" `); await queryRunner.query(` ALTER TABLE "retailer_products" DROP CONSTRAINT "FK_87839253e3642f882e0f2225f7a" `); await queryRunner.query(` ALTER TABLE "product_variants" ALTER COLUMN "productId" SET NOT NULL `); await queryRunner.query(` ALTER TABLE "product_variants" ADD CONSTRAINT "FK_f515690c571a03400a9876600b5" FOREIGN KEY ("productId") REFERENCES "aggregate_products"("id") ON DELETE NO ACTION ON UPDATE NO ACTION `); await queryRunner.query(` ALTER TABLE "retailer_products" ALTER COLUMN "aggregateProductId" SET NOT NULL `); await queryRunner.query(` ALTER TABLE "retailer_products" ADD CONSTRAINT "FK_87839253e3642f882e0f2225f7a" FOREIGN KEY ("aggregateProductId") REFERENCES "aggregate_products"("id") ON DELETE NO ACTION ON UPDATE NO ACTION `); } }