class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
@AutoIncrement
declare id: number;
}
The @AutoIncrement
decorator is used to make an attribute auto-increment,
it is a shortcut for setting the autoIncrement
option of the Attribute decorator to true.
Some dialects require the field to be a primary key.
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
@AutoIncrement
declare id: number;
}
The @AutoIncrement
decorator is used to make an attribute auto-increment,
it is a shortcut for setting the autoIncrement
option of the Attribute decorator to true.
Some dialects require the field to be a primary key.
Optional
propertyDescriptor: PropertyDescriptorclass User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
@AutoIncrement
declare id: number;
}
The
@AutoIncrement
decorator is used to make an attribute auto-increment, it is a shortcut for setting theautoIncrement
option of the Attribute decorator to true.Some dialects require the field to be a primary key.