Open AnechaS opened 1 year ago
You need to make one of the fields a primary key otherwise id is auto added as primary key
Also the error you are receiving is due to the model not being attached to the Sequelize instance, you can do that in one of two ways following the docs: https://github.com/sequelize/sequelize-typescript#configuration
Do you have an alternative solution for fixing the issue in the model file?
As given you need to make a primary key for the model otherwise a id primarykey gets added automatically. If you don't want id as your primary key then mark another field as primary key as below, you can use email ( which should be unique) and gives you a string primary key.
`@Table({ tableName: 'USERS', timestamps: false, }) export class User extends Model { @Column({ field: 'NAME' }) name: string;
@PrimaryKey @Column({ field: 'EMAIL' }) email: string; }`
give a @PrimaryKey in other filed
Nodejs v18.17.1 sequelize v 6.33.0 sequelize-typescript v2.1.5
Error