Updating environments which need to re-sync definitions.

This commit is contained in:
mike12345567 2024-06-28 12:47:57 +01:00
parent 00eba1bd35
commit 048d15956b
1 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import {
} from "./filters"
const builder = new sql.Sql(SqlClient.SQL_LITE)
const NO_SUCH_COLUMN_REGEX = new RegExp(`no such colum.+${USER_COLUMN_PREFIX}`)
function buildInternalFieldList(
table: Table,
@ -329,7 +330,10 @@ export async function search(
return response
} catch (err: any) {
const msg = typeof err === "string" ? err : err.message
if (err.status === 404 && msg?.includes(SQLITE_DESIGN_DOC_ID)) {
const syncAndRepeat =
(err.status === 400 && msg?.match(NO_SUCH_COLUMN_REGEX)) ||
(err.status === 404 && msg?.includes(SQLITE_DESIGN_DOC_ID))
if (syncAndRepeat) {
await sdk.tables.sqs.syncDefinition()
return search(options, table)
}