(hopefully) fix ER_TOO_LONG_KEY error

This commit is contained in:
2019-12-22 19:58:45 +03:00
parent 8b0ec9b1a1
commit 2db47abd20
2 changed files with 12 additions and 6 deletions

View File

@@ -23,10 +23,13 @@ export class Document extends BaseEntity {
@PrimaryGeneratedColumn()
public id: number;
@ManyToOne(type => User, user => user.documents)
@ManyToOne(
type => User,
user => user.documents,
)
public user: User;
@Column()
@Column({ length: 190 })
public name: string;
@Column({ type: "text", default: "" })

View File

@@ -29,18 +29,21 @@ export class User extends BaseEntity {
@PrimaryGeneratedColumn()
public id: number;
@Column()
@Column({ length: 190})
@Index({ unique: true })
public username: string;
@Column()
@Column({ length: 190 })
@Index({ unique: true })
public email: string;
@Column()
@Column({ length: 190 })
public passwordHash: string;
@OneToMany(type => Document, document => document.user)
@OneToMany(
type => Document,
document => document.user,
)
public documents: Document[];
constructor(username: string, email: string) {