diff --git a/CHANGELOG.md b/CHANGELOG.md index e216151edff..b9ab36e2bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug fixes and improvements (Add entries below in the order of server, console, cli, docs, others) +- server: fix add source API wiping out source's metadata when replace_configuration is true - console: add foreign key CRUD functionality to ms sql server tables - console: allow tracking of custom SQL functions having composite type (rowtype) input arguments - console: allow input object presets in remote schema permissions @@ -18,7 +19,7 @@ - server: fix asymptotic performance of fetching from the event_log table - console: add `pool_timeout`, `connection_lifetime` and `isolation_level` connection params to connect database form - console: add check constraints and comments to MS SQL Server tables' read-only modify page -- console: add create table functionality for MS SQL Server +- console: add create table functionality for MS SQL Server - console: update connect database form with SSL certificates - console: add drop table functionality to MS SQL Server tables - console: allow renaming data sources diff --git a/server/src-lib/Hasura/RQL/DDL/Schema/Source.hs b/server/src-lib/Hasura/RQL/DDL/Schema/Source.hs index 884961ed66b..ad8c207878f 100644 --- a/server/src-lib/Hasura/RQL/DDL/Schema/Source.hs +++ b/server/src-lib/Hasura/RQL/DDL/Schema/Source.hs @@ -46,13 +46,14 @@ runAddSource => AddSource b -> m EncJSON runAddSource (AddSource name sourceConfig replaceConfiguration) = do sources <- scSources <$> askSchemaCache - let sourceMetadata = mkSourceMetadata @b name sourceConfig metadataModifier <- MetadataModifier <$> if HM.member name sources then - if replaceConfiguration then pure $ metaSources.ix name .~ sourceMetadata + if replaceConfiguration then pure $ metaSources.ix name.toSourceMetadata @b.smConfiguration .~ sourceConfig else throw400 AlreadyExists $ "source with name " <> name <<> " already exists" - else pure $ metaSources %~ OMap.insert name sourceMetadata + else do + let sourceMetadata = mkSourceMetadata @b name sourceConfig + pure $ metaSources %~ OMap.insert name sourceMetadata buildSchemaCacheFor (MOSource name) metadataModifier pure successMsg