Browse Source

Change the way to define primary columns

master
Menci 6 years ago
parent
commit
fe8b087ab1
  1. 2
      models/formatted_code.ts
  2. 4
      models/problem_tag_map.ts
  3. 4
      models/rating_history.ts
  4. 4
      models/user_privilege.ts

2
models/formatted_code.ts

@ -3,7 +3,7 @@ import Model from "./common";
@TypeORM.Entity() @TypeORM.Entity()
export default class FormattedCode extends Model { export default class FormattedCode extends Model {
@TypeORM.Column({ type: "varchar", length: 50, primary: true }) @TypeORM.PrimaryColumn({ type: "varchar", length: 50 })
key: string; key: string;
@TypeORM.Column({ nullable: true, type: "mediumtext" }) @TypeORM.Column({ nullable: true, type: "mediumtext" })

4
models/problem_tag_map.ts

@ -4,10 +4,10 @@ import Model from "./common";
@TypeORM.Entity() @TypeORM.Entity()
export default class ProblemTagMap extends Model { export default class ProblemTagMap extends Model {
@TypeORM.Index() @TypeORM.Index()
@TypeORM.Column({ type: "integer", primary: true }) @TypeORM.PrimaryColumn({ type: "integer" })
problem_id: number; problem_id: number;
@TypeORM.Index() @TypeORM.Index()
@TypeORM.Column({ type: "integer", primary: true }) @TypeORM.PrimaryColumn({ type: "integer" })
tag_id: number; tag_id: number;
} }

4
models/rating_history.ts

@ -7,10 +7,10 @@ import User from "./user";
@TypeORM.Entity() @TypeORM.Entity()
export default class RatingHistory extends Model { export default class RatingHistory extends Model {
@TypeORM.Column({ type: "integer", primary: true }) @TypeORM.PrimaryColumn({ type: "integer" })
rating_calculation_id: number; rating_calculation_id: number;
@TypeORM.Column({ type: "integer", primary: true }) @TypeORM.PrimaryColumn({ type: "integer" })
user_id: number; user_id: number;
@TypeORM.Column({ nullable: true, type: "integer" }) @TypeORM.Column({ nullable: true, type: "integer" })

4
models/user_privilege.ts

@ -4,10 +4,10 @@ import Model from "./common";
@TypeORM.Entity() @TypeORM.Entity()
export default class UserPrivilege extends Model { export default class UserPrivilege extends Model {
@TypeORM.Index() @TypeORM.Index()
@TypeORM.Column({ type: "integer", primary: true }) @TypeORM.PrimaryColumn({ type: "integer" })
user_id: number; user_id: number;
@TypeORM.Index() @TypeORM.Index()
@TypeORM.Column({ type: "varchar", length: 80, primary: true }) @TypeORM.PrimaryColumn({ type: "varchar", length: 80 })
privilege: string; privilege: string;
} }

Loading…
Cancel
Save