-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ecff787
commit fac4fa3
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
apps/scv-gateway/src/database/migrations/1696408787963-SubmissionVerification.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"`, | ||
); | ||
} | ||
} |