如何设置列长度为“最大”在typepostgresql?

mi7gmzs6  于 2023-11-18  发布在  PostgreSQL
关注(0)|答案(1)|浏览(144)

我是打字机新手。我想把一列的长度设置为“MAX”。
以下是我尝试过的:

  1. @Entity('InboundCallConfig')
  2. export class InboundCallConfigEntity{
  3. @Index()
  4. @PrimaryGeneratedColumn()
  5. Id: number;
  6. @Column( { nullable: true , length: 200 })
  7. CallerId: string;
  8. @Column( { type: "varchar", length:"MAX" } )
  9. WebhookUrl :string;
  10. @Column( { type:"varchar", length: 100, nullable:true})
  11. HTTPMethod: string;
  12. @Column( {default: false} )
  13. IsDeleted: boolean;
  14. }

字符串
但是当我尝试运行我的程序时,它得到了一个错误,说:
x1c 0d1x的数据
提前感谢!

q3aa0525

q3aa05251#

基于typeorm的文档,它只接受长度属性的数字类型值:

  1. @Column({
  2. type: "varchar",
  3. length: 150,
  4. unique: true,
  5. // ...
  6. })
  7. name: string;
  8. length: number - Column type's length. For example if you want to create varchar(150) type you specify column type and length options.

字符串
mysql服务器的版本也很重要,因为有些版本不支持MAX的长度属性语法,有些版本对列的字符串字节大小有限制。

相关问题