Skip to content

Commit

Permalink
Added file to create the sticky-notes table
Browse files Browse the repository at this point in the history
Added file to create the sticky-notes table. Fixed the issue with other migration file trying to add columns to a table that did not exist.
  • Loading branch information
kevinzhong930 committed Nov 13, 2024
1 parent eccf8ad commit 8db0978
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions devU-api/src/migration/1731177885475-add-sticky-notes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddStickyNotes1731177885475 implements MigrationInterface {
name = 'AddStickyNotes1731177885475'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "sticky_notes" ("id" SERIAL NOT NULL, "submissionId" integer NOT NULL, "content" character varying NOT NULL, CONSTRAINT "PK_615fc1d0c6b75c46aa2a7dd5f0a" PRIMARY KEY ("id"))`);
await queryRunner.query(`ALTER TABLE "sticky_notes" ADD CONSTRAINT "FK_a92bd7a1dc5c606db210b176a43" FOREIGN KEY ("submissionId") REFERENCES "submissions"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "sticky_notes" DROP CONSTRAINT "FK_a92bd7a1dc5c606db210b176a43"`);
await queryRunner.query(`DROP TABLE "sticky_notes"`);
}

}

0 comments on commit 8db0978

Please sign in to comment.