enum + set for mysql (#693)

* enum + set for mysql

* enum + set for mysql | dropdown

* enum for mysql | removed empty option
This commit is contained in:
Luboš Nguyen
2024-01-23 10:05:49 +01:00
committed by GitHub
parent f2f8b9ef7e
commit cdde770810
10 changed files with 374 additions and 169 deletions

View File

@@ -205,7 +205,18 @@ export class SqlDumper implements AlterProcessor {
if (column.isPersisted) this.put(' ^persisted');
return;
}
this.put('%k', column.dataType || this.dialect.fallbackDataType);
const type = column.dataType || this.dialect.fallbackDataType;
const typeWithValues = type.match(/([^(]+)(\(.+[^)]\))/);
if (typeWithValues?.length) {
typeWithValues.shift();
this.putRaw(SqlDumper.convertKeywordCase(typeWithValues.shift()));
this.putRaw(typeWithValues);
} else {
this.putRaw(SqlDumper.convertKeywordCase(type));
}
if (column.autoIncrement) {
this.autoIncrement();
}