小编Tin*_*Roh的帖子

覆盖 TypeORM 列选项

我想为 TypeORM 实体创建一个编辑表,其中所有列都可以为空。这用于建议对最终表进行更新,并且将有 UI 允许用户接受或拒绝编辑。

我很难弄清楚如何覆盖选项@Column以使其成为可能。表达这一点的最佳方式是什么?

这是我尝试从 a 继承的方法BaseProfileEntity,但似乎不起作用:

export abstract class BaseProfileEntity {
  @Column({ nullable: true })
  public name!: string;

  @Column({ nullable: true })
  public location!: string;
}

/**
 * Edit proposal to a profile. All columns should be NULLABLE. If they are not null,
 * that means an edit for that column was proposed.
 */
export class ProfileEdit extends BaseProfileEntity {
  @Column()
  public editAuthor!: string;
}

/**
 * The final profile. I want to …
Run Code Online (Sandbox Code Playgroud)

typeorm

5
推荐指数
0
解决办法
1441
查看次数

标签 统计

typeorm ×1