Skip to content

Commit

Permalink
update migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jessehartloff committed Nov 6, 2024
1 parent 06dfd1a commit 4b30f48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)`
)
Expand Down
16 changes: 16 additions & 0 deletions devU-api/src/migration/1730867565396-publicCourses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class Migration1730867565396 implements MigrationInterface {
name = 'Migration1730867565396'

public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "private_data"`);
await queryRunner.query(`ALTER TABLE "courses" DROP COLUMN "is_public"`);
}

}

0 comments on commit 4b30f48

Please sign in to comment.