class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
declare id: number;
}
The @PrimaryKey
decorator is used to make an attribute a primary key,
it is a shortcut for setting the primaryKey
option of the Attribute decorator to true.
class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
declare id: number;
}
The @PrimaryKey
decorator is used to make an attribute a primary key,
it is a shortcut for setting the primaryKey
option of the Attribute decorator to true.
Optional
propertyDescriptor: PropertyDescriptorclass User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
@Attribute(DataTypes.INTEGER)
@PrimaryKey
declare id: number;
}
The
@PrimaryKey
decorator is used to make an attribute a primary key, it is a shortcut for setting theprimaryKey
option of the Attribute decorator to true.