From 4b30f482973bde4af6c0d84066b674724b756e07 Mon Sep 17 00:00:00 2001 From: Jesse Hartloff Date: Tue, 5 Nov 2024 23:34:22 -0500 Subject: [PATCH] update migrations --- .../1626719306608-addAssignmentsAndCourses.ts | 2 -- .../src/migration/1730867565396-publicCourses.ts | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 devU-api/src/migration/1730867565396-publicCourses.ts diff --git a/devU-api/src/migration/1626719306608-addAssignmentsAndCourses.ts b/devU-api/src/migration/1626719306608-addAssignmentsAndCourses.ts index 332ac2a8..f761ab3b 100644 --- a/devU-api/src/migration/1626719306608-addAssignmentsAndCourses.ts +++ b/devU-api/src/migration/1626719306608-addAssignmentsAndCourses.ts @@ -15,8 +15,6 @@ export class addAssignmentsAndCourses1626719306608 implements MigrationInterface "created_at" TIMESTAMP NOT NULL DEFAULT now(), "updated_at" TIMESTAMP NOT NULL DEFAULT now(), "deleted_at" TIMESTAMP, - "is_public" boolean NOT NULL DEFAULT false, - "private_data" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "courses_primary_key_constraint" PRIMARY KEY ("id") )` ) diff --git a/devU-api/src/migration/1730867565396-publicCourses.ts b/devU-api/src/migration/1730867565396-publicCourses.ts new file mode 100644 index 00000000..029ff8c8 --- /dev/null +++ b/devU-api/src/migration/1730867565396-publicCourses.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Migration1730867565396 implements MigrationInterface { + name = 'Migration1730867565396' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "courses" ADD "is_public" boolean NOT NULL DEFAULT false`); + await queryRunner.query(`ALTER TABLE "courses" ADD "private_data" TIMESTAMP NOT NULL DEFAULT now()`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "private_data"`); + await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "is_public"`); + } + +}