mirror of https://github.com/Fabio286/antares.git
fix(MySQL): wrong datetime fields default in table filler in some cases
This commit is contained in:
parent
359e14a9eb
commit
8da0224876
|
@ -441,7 +441,7 @@ export class MySQLClient extends AntaresCore {
|
||||||
collation: field.COLLATION_NAME,
|
collation: field.COLLATION_NAME,
|
||||||
autoIncrement: field.EXTRA.includes('auto_increment'),
|
autoIncrement: field.EXTRA.includes('auto_increment'),
|
||||||
onUpdate: field.EXTRA.toLowerCase().includes('on update')
|
onUpdate: field.EXTRA.toLowerCase().includes('on update')
|
||||||
? field.EXTRA.substr(field.EXTRA.indexOf('on update') + 9, field.EXTRA.length)
|
? field.EXTRA.substr(field.EXTRA.indexOf('on update') + 9, field.EXTRA.length).trim()
|
||||||
: '',
|
: '',
|
||||||
comment: field.COLUMN_COMMENT
|
comment: field.COLUMN_COMMENT
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
<label class="form-checkbox ml-3" :title="$t('word.insert')">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:checked="!field.autoIncrement"
|
:checked="!fieldsToExclude.includes(field.name)"
|
||||||
@change.prevent="toggleFields($event, field)"
|
@change.prevent="toggleFields($event, field)"
|
||||||
><i class="form-icon" />
|
><i class="form-icon" />
|
||||||
</label>
|
</label>
|
||||||
|
@ -264,7 +264,7 @@ export default {
|
||||||
else if (BIT.includes(field.type))
|
else if (BIT.includes(field.type))
|
||||||
fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', '');
|
fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', '');
|
||||||
else if (DATETIME.includes(field.type)) {
|
else if (DATETIME.includes(field.type)) {
|
||||||
if (field.default && ['current_timestamp', 'now()'].includes(field.default.toLowerCase())) {
|
if (field.default && ['current_timestamp', 'now()'].some(term => field.default.toLowerCase().includes(term))) {
|
||||||
let datePrecision = '';
|
let datePrecision = '';
|
||||||
for (let i = 0; i < field.datePrecision; i++)
|
for (let i = 0; i < field.datePrecision; i++)
|
||||||
datePrecision += i === 0 ? '.S' : 'S';
|
datePrecision += i === 0 ? '.S' : 'S';
|
||||||
|
@ -281,7 +281,7 @@ export default {
|
||||||
|
|
||||||
rowObj[field.name] = { value: fieldDefault };
|
rowObj[field.name] = { value: fieldDefault };
|
||||||
|
|
||||||
if (field.autoIncrement)// Disable by default auto increment fields
|
if (field.autoIncrement || !!field.onUpdate)// Disable by default auto increment or "on update" fields
|
||||||
this.fieldsToExclude = [...this.fieldsToExclude, field.name];
|
this.fieldsToExclude = [...this.fieldsToExclude, field.name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue