1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix: cut faker text based on field length

This commit is contained in:
2021-02-14 18:25:57 +01:00
parent a176174b8d
commit 288ff4c1a1
2 changed files with 6 additions and 2 deletions

View File

@ -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')}"`;