Switching to regex.
This commit is contained in:
parent
6db0379504
commit
1e189450c0
|
@ -45,13 +45,10 @@ import {
|
||||||
getTableIDList,
|
getTableIDList,
|
||||||
} from "./filters"
|
} from "./filters"
|
||||||
import { dataFilters } from "@budibase/shared-core"
|
import { dataFilters } from "@budibase/shared-core"
|
||||||
import { DEFAULT_TABLE_IDS } from "../../../../constants"
|
|
||||||
|
|
||||||
const builder = new sql.Sql(SqlClient.SQL_LITE)
|
const builder = new sql.Sql(SqlClient.SQL_LITE)
|
||||||
const MISSING_COLUMN_REGEX = new RegExp(`no such column: .+`)
|
const MISSING_COLUMN_REGEX = new RegExp(`no such column: .+`)
|
||||||
const USER_COLUMN_PREFIX_REGEX = new RegExp(
|
const MISSING_TABLE_REGX = new RegExp(`no such table: .+`)
|
||||||
`no such column: .+${USER_COLUMN_PREFIX}`
|
|
||||||
)
|
|
||||||
|
|
||||||
function buildInternalFieldList(
|
function buildInternalFieldList(
|
||||||
table: Table,
|
table: Table,
|
||||||
|
@ -241,9 +238,9 @@ function resyncDefinitionsRequired(status: number, message: string) {
|
||||||
// pre data_ prefix on column names, need to resync
|
// pre data_ prefix on column names, need to resync
|
||||||
return (
|
return (
|
||||||
// there are tables missing - try a resync
|
// there are tables missing - try a resync
|
||||||
(status === 400 && message.includes("no such table: ")) ||
|
(status === 400 && message.match(MISSING_TABLE_REGX)) ||
|
||||||
// there are columns missing - try a resync
|
// there are columns missing - try a resync
|
||||||
(status === 400 && message.includes("no such column: ")) ||
|
(status === 400 && message.match(MISSING_COLUMN_REGEX)) ||
|
||||||
// no design document found, needs a full sync
|
// no design document found, needs a full sync
|
||||||
(status === 404 && message?.includes(SQLITE_DESIGN_DOC_ID))
|
(status === 404 && message?.includes(SQLITE_DESIGN_DOC_ID))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue