TypeORM

184次阅读
没有评论

自动修改数据库字段类型:

column()

@Column()
content: string;

类型为varchar:255

@Column({
  type: 'longtext'
})
自动修改了字段的类型,但是该字段的内容将消失。

联表查询

默认值

@Column({
   default: 1
})
status: number;

@Column()
stauts = 1;

status = 1;
在create、new时,获取到的对象属性status=1的。

设置default: 1,在数据库层面设置了默认值为1,在create、new时,没有默认值。
正文完
 0
wujingquan
版权声明:本站原创文章,由 wujingquan 于2024-01-10发表,共计252字。
转载说明:Unless otherwise specified, all articles are published by cc-4.0 protocol. Please indicate the source of reprint.
评论(没有评论)