-
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.
Updated schema to match v0.1 frontend
- Loading branch information
1 parent
14698d4
commit aab28e3
Showing
11 changed files
with
1,121 additions
and
213 deletions.
There are no files selected for viewing
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,30 @@ | ||
import {MigrationInterface, QueryRunner} from "typeorm"; | ||
|
||
export class True1587075769273 implements MigrationInterface { | ||
name = 'True1587075769273' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE TABLE "reviews" ("id" character varying NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "created_by_id" character varying NOT NULL, "updated_at" TIMESTAMP DEFAULT now(), "updated_by_id" character varying, "deleted_at" TIMESTAMP, "deleted_by_id" character varying, "version" integer NOT NULL, "collection_item_id" character varying NOT NULL, "rating" character varying, "title" character varying, "review_text" character varying, CONSTRAINT "PK_231ae565c273ee700b283f15c1d" PRIMARY KEY ("id"))`, undefined); | ||
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "rating"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "items" DROP COLUMN "review"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" ADD "password" character varying NOT NULL`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" ADD "salt" character varying NOT NULL`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" ADD "account_settings" jsonb`, undefined); | ||
await queryRunner.query(`ALTER TABLE "collection_items" ADD "plays" integer DEFAULT 0`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" ADD CONSTRAINT "UQ_97672ac88f789774dd47f7c8be3" UNIQUE ("email")`, undefined); | ||
await queryRunner.query(`ALTER TABLE "reviews" ADD CONSTRAINT "FK_fc090d3e6b0a3b369f03d9aa673" FOREIGN KEY ("collection_item_id") REFERENCES "collection_items"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`, undefined); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "reviews" DROP CONSTRAINT "FK_fc090d3e6b0a3b369f03d9aa673"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" DROP CONSTRAINT "UQ_97672ac88f789774dd47f7c8be3"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "collection_items" DROP COLUMN "plays"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "account_settings"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "salt"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "users" DROP COLUMN "password"`, undefined); | ||
await queryRunner.query(`ALTER TABLE "items" ADD "review" character varying`, undefined); | ||
await queryRunner.query(`ALTER TABLE "items" ADD "rating" character varying`, undefined); | ||
await queryRunner.query(`DROP TABLE "reviews"`, undefined); | ||
} | ||
|
||
} |
Oops, something went wrong.