mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: issue with ENUM and SET length when creating a new field
This commit is contained in:
@ -329,7 +329,7 @@ export class MySQLClient extends AntaresCore {
|
|||||||
unsigned: field.COLUMN_TYPE.includes('unsigned'),
|
unsigned: field.COLUMN_TYPE.includes('unsigned'),
|
||||||
zerofill: field.COLUMN_TYPE.includes('zerofill'),
|
zerofill: field.COLUMN_TYPE.includes('zerofill'),
|
||||||
order: field.ORDINAL_POSITION,
|
order: field.ORDINAL_POSITION,
|
||||||
default: field.COLUMN_DEFAULT,
|
default: field.COLUMN_DEFAULT, // TODO: get from show create table
|
||||||
charset: field.CHARACTER_SET_NAME,
|
charset: field.CHARACTER_SET_NAME,
|
||||||
collation: field.COLLATION_NAME,
|
collation: field.COLLATION_NAME,
|
||||||
autoIncrement: field.EXTRA.includes('auto_increment'),
|
autoIncrement: field.EXTRA.includes('auto_increment'),
|
||||||
|
@ -492,11 +492,13 @@ export default {
|
|||||||
this.localRow.numLength = null;
|
this.localRow.numLength = null;
|
||||||
this.localRow.charLength = null;
|
this.localRow.charLength = null;
|
||||||
this.localRow.datePrecision = null;
|
this.localRow.datePrecision = null;
|
||||||
|
this.localRow.enumValues = '';
|
||||||
|
|
||||||
if (this.fieldType.length) {
|
if (this.fieldType.length) {
|
||||||
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11;
|
if (['integer', 'float', 'binary', 'spatial'].includes(this.fieldType.group)) this.localRow.numLength = 11;
|
||||||
if (['string', 'other'].includes(this.fieldType.group)) this.localRow.charLength = 15;
|
if (['string'].includes(this.fieldType.group)) this.localRow.charLength = 15;
|
||||||
if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0;
|
if (['time'].includes(this.fieldType.group)) this.localRow.datePrecision = 0;
|
||||||
|
if (['other'].includes(this.fieldType.group)) this.localRow.enumValues = '\'valA\',\'valB\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.fieldType.collation)
|
if (!this.fieldType.collation)
|
||||||
|
Reference in New Issue
Block a user