feat: add user submission history preparations
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||
|
||||
export class PrepUserSubmissionHistory1788876455659 implements MigrationInterface {
|
||||
name = 'PrepUserSubmissionHistory1788876455659';
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX "public"."unq_question_multi_choice"`);
|
||||
await queryRunner.query(`ALTER TABLE "choice" DROP COLUMN "value"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "submission_answer" ADD "createdAt" TIMESTAMP NOT NULL DEFAULT now()`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "submission" ADD "code" character varying`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "submission" ADD "completedAt" TIMESTAMP WITH TIME ZONE`,
|
||||
);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "submission" DROP COLUMN "completedAt"`,
|
||||
);
|
||||
await queryRunner.query(`ALTER TABLE "submission" DROP COLUMN "code"`);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "submission_answer" DROP COLUMN "createdAt"`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`ALTER TABLE "choice" ADD "value" integer NOT NULL`,
|
||||
);
|
||||
await queryRunner.query(
|
||||
`CREATE UNIQUE INDEX "unq_question_multi_choice" ON "question_transition" ("type", "fromQuestionId") WHERE (type = 'multi-choice'::question_transition_type_enum)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user