mirror of https://github.com/Fabio286/antares.git
fix: cut faker text based on field length
This commit is contained in:
parent
a176174b8d
commit
288ff4c1a1
|
@ -240,8 +240,11 @@ export default (connections) => {
|
|||
else { // Faker value
|
||||
let fakeValue = faker[params.row[key].group][params.row[key].method]();
|
||||
|
||||
if ([...TEXT, ...LONG_TEXT].includes(type))
|
||||
if ([...TEXT, ...LONG_TEXT].includes(type)) {
|
||||
if (params.row[key].length)
|
||||
fakeValue = fakeValue.substr(0, params.row[key].length);
|
||||
fakeValue = `"${sqlEscaper(fakeValue)}"`;
|
||||
}
|
||||
else if ([...DATE, ...DATETIME].includes(type))
|
||||
fakeValue = `"${moment(fakeValue).format('YYYY-MM-DD HH:mm:ss.SSSSSS')}"`;
|
||||
|
||||
|
|
|
@ -197,7 +197,8 @@ export default {
|
|||
this.$emit('update:value', {
|
||||
group: this.selectedGroup,
|
||||
method: this.selectedMethod,
|
||||
value: this.selectedValue
|
||||
value: this.selectedValue,
|
||||
length: this.fieldLength
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue