I am new to typeorm. I want to set the length of a column to "MAX".
Here is what I've tried:
@Entity('InboundCallConfig')
export class InboundCallConfigEntity{
@Index()
@PrimaryGeneratedColumn()
Id: number;
@Column( { nullable: true , length: 200 })
CallerId: string;
@Column( { type: "varchar", length:"MAX" } )
WebhookUrl :string;
@Column( { type:"varchar", length: 100, nullable:true})
HTTPMethod: string;
@Column( {default: false} )
IsDeleted: boolean;
}
but when I try to run my program it got an error saying :
Thanks in advance!
Based on the documentation of typeorm it only accepts number type value for length property :
@Column({
type: "varchar",
length: 150,
unique: true,
// ...
})
name: string;
length: number - Column type's length. For example if you want to create varchar(150) type you specify column type and length options.
Also mysql server version is important because some versions don't support MAX
syntax on length property and some has restrictions on string byte size of a column .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With