Merge pull request #12706 from Budibase/BUDI-7571/refetching-tables-deletes-pre-existing-views

Refetching tables deletes pre existing views
This commit is contained in:
Adria Navarro 2024-01-04 17:05:14 +01:00 committed by GitHub
commit 3e6848fda5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -305,8 +305,8 @@ export function shouldCopySpecialColumn(
} }
/** /**
* Looks for columns which need to be copied over into the new table definitions, like relationships * Looks for columns which need to be copied over into the new table definitions, like relationships,
* and options types. * options types and views.
* @param tableName The name of the table which is being checked. * @param tableName The name of the table which is being checked.
* @param table The specific table which is being checked. * @param table The specific table which is being checked.
* @param entities All the tables that existed before - the old table definitions. * @param entities All the tables that existed before - the old table definitions.
@ -325,6 +325,9 @@ function copyExistingPropsOver(
if (entities[tableName]?.created) { if (entities[tableName]?.created) {
table.created = entities[tableName]?.created table.created = entities[tableName]?.created
} }
table.views = entities[tableName].views
const existingTableSchema = entities[tableName].schema const existingTableSchema = entities[tableName].schema
for (let key in existingTableSchema) { for (let key in existingTableSchema) {
if (!existingTableSchema.hasOwnProperty(key)) { if (!existingTableSchema.hasOwnProperty(key)) {