Skip to content

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
chelsea-EYDS committed Oct 31, 2023
1 parent 773beef commit 9479755
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class Migration1698766293216 implements MigrationInterface {
name = 'FKMigration1698766293216';
export class Migration1698772487856 implements MigrationInterface {
name = 'FKMigration1698772487856';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "public"."location_source_idx"`);
await queryRunner.query(
`ALTER TABLE "location" DROP CONSTRAINT "UQ_62c907775331b5aa98ec8daf7dd"`
);
await queryRunner.query(`ALTER TABLE "transaction" ADD "location" uuid`);
await queryRunner.query(`ALTER TABLE "pos_deposit" ADD "merchant" uuid`);
await queryRunner.query(`ALTER TABLE "cash_deposit" ADD "bank" uuid`);
await queryRunner.query(
`CREATE UNIQUE INDEX "location_source_idx" ON "location" ("location_id", "source_id") `
`ALTER TABLE "location" ADD CONSTRAINT "UQ_346127033e9c6ca7ffa2df9ecbf" UNIQUE ("location_id", "source_id")`
);
await queryRunner.query(
`ALTER TABLE "transaction" ADD CONSTRAINT "FK_dd423da8b6167163d79d3c06953" FOREIGN KEY ("location") REFERENCES "location"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`
Expand All @@ -32,12 +34,14 @@ export class Migration1698766293216 implements MigrationInterface {
await queryRunner.query(
`ALTER TABLE "transaction" DROP CONSTRAINT "FK_dd423da8b6167163d79d3c06953"`
);
await queryRunner.query(`DROP INDEX "public"."location_source_idx"`);
await queryRunner.query(
`ALTER TABLE "location" DROP CONSTRAINT "UQ_346127033e9c6ca7ffa2df9ecbf"`
);
await queryRunner.query(`ALTER TABLE "cash_deposit" DROP COLUMN "bank"`);
await queryRunner.query(`ALTER TABLE "pos_deposit" DROP COLUMN "merchant"`);
await queryRunner.query(`ALTER TABLE "transaction" DROP COLUMN "location"`);
await queryRunner.query(
`CREATE UNIQUE INDEX "location_source_idx" ON "location" ("id", "source_id", "location_id") `
`ALTER TABLE "location" ADD CONSTRAINT "UQ_62c907775331b5aa98ec8daf7dd" UNIQUE ("source_id", "location_id")`
);
}
}

0 comments on commit 9479755

Please sign in to comment.