Skip to content

Commit

Permalink
add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeromanowicz committed Oct 4, 2023
1 parent ecff787 commit fac4fa3
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class SubmissionVerification1696408787963 implements MigrationInterface {
name = 'SubmissionVerification1696408787963';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "contract_submissions" ADD "submitted_at" TIMESTAMP NOT NULL DEFAULT now()`,
);
await queryRunner.query(
`CREATE TYPE "public"."contract_submissions_status_enum" AS ENUM('pending', 'success', 'fail')`,
);
await queryRunner.query(
`ALTER TABLE "contract_submissions" ADD "status" "public"."contract_submissions_status_enum" NOT NULL DEFAULT 'pending'`,
);
await queryRunner.query(
`ALTER TABLE "contract_submissions" ADD "result" character varying`,
);
await queryRunner.query(
`ALTER TABLE "contract_source_files" DROP COLUMN "file_path"`,
);
await queryRunner.query(
`ALTER TABLE "contract_source_files" ADD "file_path" character varying NOT NULL`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "contract_source_files" DROP COLUMN "file_path"`,
);
await queryRunner.query(
`ALTER TABLE "contract_source_files" ADD "file_path" character varying(127) NOT NULL`,
);
await queryRunner.query(
`ALTER TABLE "contract_submissions" DROP COLUMN "result"`,
);
await queryRunner.query(
`ALTER TABLE "contract_submissions" DROP COLUMN "status"`,
);
await queryRunner.query(
`DROP TYPE "public"."contract_submissions_status_enum"`,
);
await queryRunner.query(
`ALTER TABLE "contract_submissions" DROP COLUMN "submitted_at"`,
);
}
}

0 comments on commit fac4fa3

Please sign in to comment.