From 92950cef91893f4b6f3d8e3d10e8ed2f03196e5a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 Jan 2024 15:43:11 +0100 Subject: [PATCH] Maintain views on finaliseExternalTables --- packages/server/src/integrations/utils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 89612cc251..102dfe2935 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -305,8 +305,8 @@ export function shouldCopySpecialColumn( } /** - * Looks for columns which need to be copied over into the new table definitions, like relationships - * and options types. + * Looks for columns which need to be copied over into the new table definitions, like relationships, + * options types and views. * @param tableName The name of the 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. @@ -325,6 +325,9 @@ function copyExistingPropsOver( if (entities[tableName]?.created) { table.created = entities[tableName]?.created } + + table.views = entities[tableName].views + const existingTableSchema = entities[tableName].schema for (let key in existingTableSchema) { if (!existingTableSchema.hasOwnProperty(key)) {