|
|
|
@ -209,17 +209,19 @@ async function addIfMissingAndSave() {
|
|
|
|
|
const updatedColMeta = { ...column.value } |
|
|
|
|
|
|
|
|
|
// 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 (isPg.value) { |
|
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.substring( |
|
|
|
|
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) { |
|
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'") |
|
|
|
|
if (updatedColMeta.cdf) { |
|
|
|
|
// 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 (isPg.value) { |
|
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.substring( |
|
|
|
|
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) { |
|
|
|
|
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await $api.dbTableColumn.update( |
|
|
|
|