fix: mark primary key auto-increment only if column type is TINYINT SMALLINT MEDIUMINT INT BIGINT
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
This commit is contained in:
parent
b0a5ccc677
commit
b657e73ede
|
@ -628,7 +628,13 @@ function mixinMigration(MySQL, mysql) {
|
|||
if (pks.length === 1) {
|
||||
const idName = this.idName(model);
|
||||
const idProp = this.getModelDefinition(model).properties[idName];
|
||||
if (idProp.generated) {
|
||||
const idColumnType = this.columnDataType(model, idName);
|
||||
if (idProp.generated && (
|
||||
idColumnType === 'TINYINT' ||
|
||||
idColumnType === 'SMALLINT' ||
|
||||
idColumnType === 'MEDIUMINT' ||
|
||||
idColumnType === 'INT' ||
|
||||
idColumnType === 'BIGINT')) {
|
||||
sql.push(self.columnEscaped(model, idName) + ' ' +
|
||||
self.buildColumnDefinition(model, idName) + ' AUTO_INCREMENT PRIMARY KEY');
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue