提问人:Chris Barr 提问时间:11/1/2023 更新时间:11/1/2023 访问量:21
如何在NestJS中定义Postgres DB列顺序?
How to define Postgres DB column order in NestJS?
问:
这是一个非常小的烦恼,但是在我的 NestJS 应用程序中,我有这个实体:
@Entity({ name: DB_TABLE_NAME_TEST })
export class TestEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Exclude({ toPlainOnly: true }) //hide from response objects
@ManyToOne(() => AccountEntity, (acct) => acct.id)
@JoinColumn()
account: string;
@Column()
description: string;
@Column()
testerName: string;
@Column()
testerEmail: string;
@Column({ type: 'jsonb', array: false, default: () => "'[]'", nullable: false })
@Type(() => Array<ITestEvent>)
eventList: Array<ITestEvent>;
@Column({ type: 'jsonb', array: false, default: () => "'[]'", nullable: false })
@Type(() => Array<QuestionLibraryEntity>)
questionLibraries: Array<QuestionLibraryEntity>;
}
当它为 PostgreSQL 创建表时,pgAdmin 中的列以不同的顺序显示
这很烦人的唯一原因是因为我有 2 列,其中的数据可能很长,因此将列推离屏幕。我更愿意把它放在列旁边,就像我在 NestJS 实体中定义的那样。jsonb
accountId
id
有没有办法定义列顺序?
答: 暂无答案
评论
account
id
ManyToOne