I have two fields that need to be automatically generated.
they are:
columns: [
{
name: 'ID_TIPO_ENTREGA',
type: 'uuid',
isPrimary: true,
generationStrategy: 'uuid',
default: 'uuid_generate_v4()',
},
{
name: 'CD_TIPO_ENTREGA',
type: 'int',
generationStrategy: 'increment',
default: 2021,
},
but CD_TIPO_ENTREGA field is not being generated automatically.
Is and my entity file:
@Entity(TABLE_NAME)
class TiposEntrega {
@PrimaryGeneratedColumn('uuid', { name: ID_TIPO_ENTREGA })
id: string;
@Column({ type: 'int', name: CD_TIPO_ENTREGA, default: 2021 })
@Generated('increment')
cdTipoEntrega: number;
my ID_TIPO_ENTREGA field, generates the uuid perfectly, remembering that I'm using the postgres database.
Does anyone have any suggestions?
I solved the issue by adding the following to my field:
{
name: 'CD_TIPO_ENTREGA',
type: 'integer',
isGenerated: true,
generationStrategy: 'increment',
},
I managed to solve from this link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.