I have a table - source_rule_role with two composite primary key: ruleId, roleId.
I need to add another column - rowNum, that the new primary key will be composite of three columns: ruleId, roleId, rowNum.
I tried in my migration:
...
.then(() => {
migration.addColumn(
'source_rule_role',
'rowNum',
{
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
defaultValue: 1
})
})
...
but I get a Multiple primary key defined error.
When I add the rowNum column, not as a primary key, it works.
try: