You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some years ago this same issue came up in db-migrate/node-db-migrate#408. This was fixed by adding a check for a null options param:
if (spec.primaryKey) {
if (!options || options.emitPrimaryKey) {
constraint.push('PRIMARY KEY');
}
}
A year later the call to createColumnDef from addColumn was changed to pass {} instead of null as options, which means this check always fails and the PRIMARY KEY constraint is never added. If you add an autoincrement field you are unable to set it as a primary key, resulting in the migration always failing with this error:
ER_WRONG_AUTO_KEY: Incorrect table definition; there can be only one auto column and it must be defined as a key
I have a PR to check for an empty object instead in the mysql adapter. This could be fixed upstream by changing the call to createColumnDef in db-migrate-base, but I'm hesitant to fix it there as other adapters don't seem to be having the issue.
The text was updated successfully, but these errors were encountered:
Some years ago this same issue came up in db-migrate/node-db-migrate#408. This was fixed by adding a check for a null
options
param:A year later the call to
createColumnDef
fromaddColumn
was changed to pass{}
instead ofnull
asoptions
, which means this check always fails and thePRIMARY KEY
constraint is never added. If you add an autoincrement field you are unable to set it as a primary key, resulting in the migration always failing with this error:I have a PR to check for an empty object instead in the mysql adapter. This could be fixed upstream by changing the call to
createColumnDef
indb-migrate-base
, but I'm hesitant to fix it there as other adapters don't seem to be having the issue.The text was updated successfully, but these errors were encountered: