mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-17 12:10:39 +01:00
fix: unable to add new ENUM fields
This commit is contained in:
parent
0d6137195d
commit
1e37f2a96f
@ -309,6 +309,25 @@ export class MySQLClient extends AntaresCore {
|
||||
.orderBy({ ORDINAL_POSITION: 'ASC' })
|
||||
.run();
|
||||
|
||||
// const { rows } = await this.raw(`SHOW CREATE TABLE ${schema}.${table}`);
|
||||
|
||||
// const fields = rows.map(row => {
|
||||
// let n = 0;
|
||||
// return row['Create Table']
|
||||
// .split('')
|
||||
// .reduce((acc, curr) => {
|
||||
// if (curr === ')') n--;
|
||||
// if (n !== 0) acc += curr;
|
||||
// if (curr === '(') n++;
|
||||
// return acc;
|
||||
// }, '')
|
||||
// .replaceAll('\n', '')
|
||||
// .split(',')
|
||||
// .map(f => {
|
||||
// return f.trim();// TODO: here map the field
|
||||
// });
|
||||
// });
|
||||
|
||||
return rows.map(field => {
|
||||
let numLength = field.COLUMN_TYPE.match(/int\(([^)]+)\)/);
|
||||
numLength = numLength ? +numLength.pop() : null;
|
||||
@ -1084,7 +1103,7 @@ export class MySQLClient extends AntaresCore {
|
||||
// ADD FIELDS
|
||||
additions.forEach(addition => {
|
||||
const typeInfo = this._getTypeInfo(addition.type);
|
||||
const length = typeInfo.length ? addition.numLength || addition.charLength || addition.datePrecision : false;
|
||||
const length = typeInfo.length ? addition.enumValues || addition.numLength || addition.charLength || addition.datePrecision : false;
|
||||
|
||||
alterColumns.push(`ADD COLUMN \`${addition.name}\`
|
||||
${addition.type.toUpperCase()}${length ? `(${length})` : ''}
|
||||
|
@ -96,7 +96,12 @@
|
||||
class="cell-content"
|
||||
@dblclick="editON($event, localLength, 'length')"
|
||||
>
|
||||
{{ localLength }}
|
||||
<span v-if="localRow.enumValues">
|
||||
{{ localRow.enumValues }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ localLength }}
|
||||
</span>
|
||||
</span>
|
||||
<input
|
||||
v-else-if="localRow.enumValues"
|
||||
@ -361,7 +366,7 @@ export default {
|
||||
getWorkspace: 'workspaces/getWorkspace'
|
||||
}),
|
||||
localLength () {
|
||||
return this.localRow.enumValues || this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
||||
return this.localRow.numLength || this.localRow.charLength || this.localRow.datePrecision || this.localRow.numPrecision || 0;
|
||||
},
|
||||
fieldType () {
|
||||
const fieldType = this.dataTypes.reduce((acc, group) => [...acc, ...group.types], []).filter(type =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user