We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b0a5ccc commit b657e73Copy full SHA for b657e73
lib/migration.js
@@ -628,7 +628,13 @@ function mixinMigration(MySQL, mysql) {
628
if (pks.length === 1) {
629
const idName = this.idName(model);
630
const idProp = this.getModelDefinition(model).properties[idName];
631
- if (idProp.generated) {
+ const idColumnType = this.columnDataType(model, idName);
632
+ if (idProp.generated && (
633
+ idColumnType === 'TINYINT' ||
634
+ idColumnType === 'SMALLINT' ||
635
+ idColumnType === 'MEDIUMINT' ||
636
+ idColumnType === 'INT' ||
637
+ idColumnType === 'BIGINT')) {
638
sql.push(self.columnEscaped(model, idName) + ' ' +
639
self.buildColumnDefinition(model, idName) + ' AUTO_INCREMENT PRIMARY KEY');
640
} else {
0 commit comments