|
|
@ -209,17 +209,19 @@ async function addIfMissingAndSave() { |
|
|
|
const updatedColMeta = { ...column.value } |
|
|
|
const updatedColMeta = { ...column.value } |
|
|
|
|
|
|
|
|
|
|
|
// todo: refactor and avoid repetition |
|
|
|
// todo: refactor and avoid repetition |
|
|
|
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases |
|
|
|
if (updatedColMeta.cdf) { |
|
|
|
if (isPg.value) { |
|
|
|
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases |
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.substring( |
|
|
|
if (isPg.value) { |
|
|
|
updatedColMeta.cdf.indexOf(`'`) + 1, |
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.substring( |
|
|
|
updatedColMeta.cdf.lastIndexOf(`'`), |
|
|
|
updatedColMeta.cdf.indexOf(`'`) + 1, |
|
|
|
) |
|
|
|
updatedColMeta.cdf.lastIndexOf(`'`), |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped |
|
|
|
|
|
|
|
if (!isMysql.value) { |
|
|
|
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped |
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'") |
|
|
|
if (!isMysql.value) { |
|
|
|
|
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await $api.dbTableColumn.update( |
|
|
|
await $api.dbTableColumn.update( |
|
|
|