Skip to content

Commit

Permalink
fix: issue with ENUM and SET length when creating a new field
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed May 13, 2021
1 parent c7663be commit 7a62131
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/libs/clients/MySQLClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class MySQLClient extends AntaresCore {
unsigned: field.COLUMN_TYPE.includes('unsigned'),
zerofill: field.COLUMN_TYPE.includes('zerofill'),
order: field.ORDINAL_POSITION,
default: field.COLUMN_DEFAULT,
default: field.COLUMN_DEFAULT, // TODO: get from show create table
charset: field.CHARACTER_SET_NAME,
collation: field.COLLATION_NAME,
autoIncrement: field.EXTRA.includes('auto_increment'),
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/components/WorkspacePropsTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,13 @@ export default {
this.localRow.numLength = null;
this.localRow.charLength = null;
this.localRow.datePrecision = null;
this.localRow.enumValues = '';
if (this.fieldType.length) {
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 (['other'].includes(this.fieldType.group)) this.localRow.enumValues = '\'valA\',\'valB\'';
}
if (!this.fieldType.collation)
Expand Down

0 comments on commit 7a62131

Please sign in to comment.