diff --git a/src/main/libs/clients/MySQLClient.js b/src/main/libs/clients/MySQLClient.js index 92169600..6f2e86ba 100644 --- a/src/main/libs/clients/MySQLClient.js +++ b/src/main/libs/clients/MySQLClient.js @@ -333,8 +333,15 @@ export class MySQLClient extends AntaresCore { const details = fieldArr.slice(2).join(' '); let defaultValue = null; - if (details.includes('DEFAULT')) + if (details.includes('DEFAULT')) { defaultValue = details.match(/(?<=DEFAULT ).*?$/gs)[0].split(' COMMENT')[0]; + const defaultValueArr = defaultValue.split(''); + if (defaultValueArr[0] === '\'') { + defaultValueArr.shift(); + defaultValueArr.pop(); + defaultValue = defaultValueArr.join(''); + } + } const typeAndLength = nameAndType[1].replace(')', '').split('('); diff --git a/src/renderer/components/ModalFakerRows.vue b/src/renderer/components/ModalFakerRows.vue index 7f1b9948..798edaf2 100644 --- a/src/renderer/components/ModalFakerRows.vue +++ b/src/renderer/components/ModalFakerRows.vue @@ -252,32 +252,31 @@ export default { else { if ([...NUMBER, ...FLOAT].includes(field.type)) fieldDefault = Number.isNaN(+field.default) ? null : +field.default; - - if ([...TEXT, ...LONG_TEXT].includes(field.type)) { + else if ([...TEXT, ...LONG_TEXT].includes(field.type)) { fieldDefault = field.default ? field.default.includes('\'') ? field.default.split('\'')[1] : field.default : ''; } - - if ([...TIME, ...DATE].includes(field.type)) + else if ([...TIME, ...DATE].includes(field.type)) fieldDefault = field.default; - - if (BIT.includes(field.type)) + else if (BIT.includes(field.type)) fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', ''); - - if (DATETIME.includes(field.type)) { - if (field.default && field.default.toLowerCase().includes('current_timestamp')) { + else if (DATETIME.includes(field.type)) { + if (field.default && ['current_timestamp', 'now()'].includes(field.default.toLowerCase())) { let datePrecision = ''; for (let i = 0; i < field.datePrecision; i++) datePrecision += i === 0 ? '.S' : 'S'; fieldDefault = moment().format(`YYYY-MM-DD HH:mm:ss${datePrecision}`); } + else + fieldDefault = field.default; } - - if (field.enumValues) + else if (field.enumValues) fieldDefault = field.enumValues.replaceAll('\'', '').split(','); + else + fieldDefault = field.default; } rowObj[field.name] = { value: fieldDefault }; diff --git a/src/renderer/components/WorkspacePropsOptionsModal.vue b/src/renderer/components/WorkspacePropsOptionsModal.vue index f0bce107..c1c304d5 100644 --- a/src/renderer/components/WorkspacePropsOptionsModal.vue +++ b/src/renderer/components/WorkspacePropsOptionsModal.vue @@ -48,6 +48,7 @@ v-model="optionsProxy.autoIncrement" class="form-input" type="number" + :disabled="optionsProxy.autoIncrement === null" > diff --git a/src/renderer/components/WorkspaceQueryTab.vue b/src/renderer/components/WorkspaceQueryTab.vue index 6cfc02c2..2d608f22 100644 --- a/src/renderer/components/WorkspaceQueryTab.vue +++ b/src/renderer/components/WorkspaceQueryTab.vue @@ -284,7 +284,7 @@ export default { .query-area-resizer { position: absolute; - height: 5px; + height: 4px; bottom: 40px; width: 100%; cursor: ns-resize;