cli
cli copied to clipboard
Duplicate id column on model:generate
What you are doing?
npx sequelize-cli model:generate --name Company --attributes name:string,id:number
What do you expect to happen?
- Either give error because
idcolumn already getting defined via this command; - Or create only only one
idcolumn without any default assumptions because I give a column name as 'id'
What is actually happening?
This is the generated model which has two id columns (unacceptable)
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Companies', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING
},
id: {
type: Sequelize.NUMBER
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('Companies');
}
};
Dialect: postgres (but probably this is for all) Database version: Not important Sequelize CLI version: 5.5.1 Sequelize version: 5.21.5
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any news about this?