From fe8b087ab100def64e6df4a4568f1d0f00b08608 Mon Sep 17 00:00:00 2001 From: Menci Date: Fri, 19 Apr 2019 11:03:14 +0800 Subject: [PATCH] Change the way to define primary columns --- models/formatted_code.ts | 2 +- models/problem_tag_map.ts | 4 ++-- models/rating_history.ts | 4 ++-- models/user_privilege.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/models/formatted_code.ts b/models/formatted_code.ts index 3de8735..362860f 100644 --- a/models/formatted_code.ts +++ b/models/formatted_code.ts @@ -3,7 +3,7 @@ import Model from "./common"; @TypeORM.Entity() export default class FormattedCode extends Model { - @TypeORM.Column({ type: "varchar", length: 50, primary: true }) + @TypeORM.PrimaryColumn({ type: "varchar", length: 50 }) key: string; @TypeORM.Column({ nullable: true, type: "mediumtext" }) diff --git a/models/problem_tag_map.ts b/models/problem_tag_map.ts index f7f710b..b054821 100644 --- a/models/problem_tag_map.ts +++ b/models/problem_tag_map.ts @@ -4,10 +4,10 @@ import Model from "./common"; @TypeORM.Entity() export default class ProblemTagMap extends Model { @TypeORM.Index() - @TypeORM.Column({ type: "integer", primary: true }) + @TypeORM.PrimaryColumn({ type: "integer" }) problem_id: number; @TypeORM.Index() - @TypeORM.Column({ type: "integer", primary: true }) + @TypeORM.PrimaryColumn({ type: "integer" }) tag_id: number; } diff --git a/models/rating_history.ts b/models/rating_history.ts index 86161f7..2219db3 100644 --- a/models/rating_history.ts +++ b/models/rating_history.ts @@ -7,10 +7,10 @@ import User from "./user"; @TypeORM.Entity() export default class RatingHistory extends Model { - @TypeORM.Column({ type: "integer", primary: true }) + @TypeORM.PrimaryColumn({ type: "integer" }) rating_calculation_id: number; - @TypeORM.Column({ type: "integer", primary: true }) + @TypeORM.PrimaryColumn({ type: "integer" }) user_id: number; @TypeORM.Column({ nullable: true, type: "integer" }) diff --git a/models/user_privilege.ts b/models/user_privilege.ts index fcb997c..2e8a4ab 100644 --- a/models/user_privilege.ts +++ b/models/user_privilege.ts @@ -4,10 +4,10 @@ import Model from "./common"; @TypeORM.Entity() export default class UserPrivilege extends Model { @TypeORM.Index() - @TypeORM.Column({ type: "integer", primary: true }) + @TypeORM.PrimaryColumn({ type: "integer" }) user_id: number; @TypeORM.Index() - @TypeORM.Column({ type: "varchar", length: 80, primary: true }) + @TypeORM.PrimaryColumn({ type: "varchar", length: 80 }) privilege: string; }