import { MigrationInterface, QueryRunner } from 'typeorm'; export class RemoveOldProductVariantTable1664458116594 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(`DROP TABLE product_variants`); } public async down(queryRunner: QueryRunner): Promise { await queryRunner.query(` CREATE TABLE public.product_variants ( id uuid DEFAULT public.uuid_generate_v4() NOT NULL, "createdAt" timestamp with time zone DEFAULT now() NOT NULL, "updatedAt" timestamp with time zone DEFAULT now(), "deletedAt" timestamp with time zone, identifiers text[] DEFAULT '{}'::text[] NOT NULL, discoverable boolean, asin text, dimensions text, "colorCode" text, annotations text, description text, name text, price double precision NOT NULL, "isAvailable" boolean, distributor text, "distributorSKU" text, "imageUrls" text[] DEFAULT '{}'::text[] NOT NULL, "productId" uuid, category text ) `); await queryRunner.query( `ALTER TABLE public.product_variants ADD CONSTRAINT "PK_281e3f2c55652d6a22c0aa59fd7" PRIMARY KEY (id)` ); await queryRunner.query( `CREATE INDEX "IDX_1ceb1230ecc0b95faf406e1fa2" ON public.product_variants USING btree (identifiers)` ); await queryRunner.query( `ALTER TABLE public.product_variants ADD CONSTRAINT "FK_f515690c571a03400a9876600b5" FOREIGN KEY ("productId") REFERENCES public.aggregate_products(id)` ); } }