diff --git a/bootstrap/sql/com.mysql.cj.jdbc.Driver/v012__create_db_connection_info.sql b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v012__create_db_connection_info.sql index 9676d24deea..5aac9d96226 100644 --- a/bootstrap/sql/com.mysql.cj.jdbc.Driver/v012__create_db_connection_info.sql +++ b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v012__create_db_connection_info.sql @@ -1,46 +1,7 @@ --- we are not using the secretsManagerCredentials -UPDATE metadata_service_entity -SET json = JSON_REMOVE(json, '$.openMetadataServerConnection.secretsManagerCredentials') -where name = 'OpenMetadata'; - --- Rename githubCredentials to gitCredentials -UPDATE dashboard_service_entity -SET json = JSON_INSERT( - JSON_REMOVE(json, '$.connection.config.githubCredentials'), - '$.connection.config.gitCredentials', - JSON_EXTRACT(json, '$.connection.config.githubCredentials') - ) -WHERE serviceType = 'Looker' - AND JSON_EXTRACT(json, '$.connection.config.githubCredentials') IS NOT NULL; - - --- Rename gcsConfig in BigQuery to gcpConfig -UPDATE dbservice_entity -SET json = JSON_INSERT( - JSON_REMOVE(json, '$.connection.config.credentials.gcsConfig'), - '$.connection.config.credentials.gcpConfig', - JSON_EXTRACT(json, '$.connection.config.credentials.gcsConfig') -) where serviceType in ('BigQuery'); - --- Rename gcsConfig in Datalake to gcpConfig -UPDATE dbservice_entity -SET json = JSON_INSERT( - JSON_REMOVE(json, '$.connection.config.configSource.securityConfig.gcsConfig'), - '$.connection.config.configSource.securityConfig.gcpConfig', - JSON_EXTRACT(json, '$.connection.config.configSource.securityConfig.gcsConfig') -) where serviceType in ('Datalake'); - - --- Rename gcsConfig in dbt to gcpConfig -UPDATE ingestion_pipeline_entity -SET json = JSON_INSERT( - JSON_REMOVE(json, '$.sourceConfig.config.dbtConfigSource.dbtSecurityConfig.gcsConfig'), - '$.sourceConfig.config.dbtConfigdbtSecurityConfig.gcpConfig', - JSON_EXTRACT(json, '$.sourceConfig.config.dbtConfigSource.dbtSecurityConfig.gcsConfig') -) -WHERE json -> '$.sourceConfig.config.type' = 'DBT'; - -- use FQN instead of name for Test Connection Definition ALTER TABLE test_connection_definition ADD fullyQualifiedName VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.fullyQualifiedName') NOT NULL, DROP COLUMN name; + +-- Since we are not deleting the test connection defs anymore, clean it up +TRUNCATE TABLE test_connection_definition; diff --git a/bootstrap/sql/com.mysql.cj.jdbc.Driver/v013__create_db_connection_info.sql b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v013__create_db_connection_info.sql new file mode 100644 index 00000000000..0b5f22dca01 --- /dev/null +++ b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v013__create_db_connection_info.sql @@ -0,0 +1,41 @@ +-- we are not using the secretsManagerCredentials +UPDATE metadata_service_entity +SET json = JSON_REMOVE(json, '$.openMetadataServerConnection.secretsManagerCredentials') +where name = 'OpenMetadata'; + +-- Rename githubCredentials to gitCredentials +UPDATE dashboard_service_entity +SET json = JSON_INSERT( + JSON_REMOVE(json, '$.connection.config.githubCredentials'), + '$.connection.config.gitCredentials', + JSON_EXTRACT(json, '$.connection.config.githubCredentials') + ) +WHERE serviceType = 'Looker' + AND JSON_EXTRACT(json, '$.connection.config.githubCredentials') IS NOT NULL; + + +-- Rename gcsConfig in BigQuery to gcpConfig +UPDATE dbservice_entity +SET json = JSON_INSERT( + JSON_REMOVE(json, '$.connection.config.credentials.gcsConfig'), + '$.connection.config.credentials.gcpConfig', + JSON_EXTRACT(json, '$.connection.config.credentials.gcsConfig') +) where serviceType in ('BigQuery'); + +-- Rename gcsConfig in Datalake to gcpConfig +UPDATE dbservice_entity +SET json = JSON_INSERT( + JSON_REMOVE(json, '$.connection.config.configSource.securityConfig.gcsConfig'), + '$.connection.config.configSource.securityConfig.gcpConfig', + JSON_EXTRACT(json, '$.connection.config.configSource.securityConfig.gcsConfig') +) where serviceType in ('Datalake'); + + +-- Rename gcsConfig in dbt to gcpConfig +UPDATE ingestion_pipeline_entity +SET json = JSON_INSERT( + JSON_REMOVE(json, '$.sourceConfig.config.dbtConfigSource.dbtSecurityConfig.gcsConfig'), + '$.sourceConfig.config.dbtConfigdbtSecurityConfig.gcpConfig', + JSON_EXTRACT(json, '$.sourceConfig.config.dbtConfigSource.dbtSecurityConfig.gcsConfig') +) +WHERE json -> '$.sourceConfig.config.type' = 'DBT'; diff --git a/bootstrap/sql/org.postgresql.Driver/v012__create_db_connection_info.sql b/bootstrap/sql/org.postgresql.Driver/v012__create_db_connection_info.sql index ab134b94d21..0ce448ebd20 100644 --- a/bootstrap/sql/org.postgresql.Driver/v012__create_db_connection_info.sql +++ b/bootstrap/sql/org.postgresql.Driver/v012__create_db_connection_info.sql @@ -1,34 +1,7 @@ --- we are not using the secretsManagerCredentials -UPDATE metadata_service_entity -SET json = json::jsonb #- '{openMetadataServerConnection.secretsManagerCredentials}' -where name = 'OpenMetadata'; - --- Rename githubCredentials to gitCredentials -UPDATE dashboard_service_entity -SET json = jsonb_set(json, '{connection,config,gitCredentials}', json#>'{connection,config,githubCredentials}') - where serviceType = 'Looker' - and json#>'{connection,config,githubCredentials}' is not null; - --- Rename gcsConfig in BigQuery to gcpConfig -UPDATE dbservice_entity -SET json = jsonb_set(json, '{connection,config,credentials,gcpConfig}', -json#>'{connection,config,credentials,gcsConfig}') -where serviceType in ('BigQuery') - and json#>'{connection,config,credentials,gcsConfig}' is not null; - --- Rename gcsConfig in Datalake to gcpConfig -UPDATE dbservice_entity -SET json = jsonb_set(json, '{connection,config,configSource,securityConfig,gcpConfig}', -json#>'{connection,config,configSource,securityConfig,gcsConfig}') -where serviceType in ('Datalake') - and json#>'{connection,config,configSource,securityConfig,gcsConfig}' is not null; - --- Rename gcsConfig in dbt to gcpConfig -UPDATE ingestion_pipeline_entity -SET json = jsonb_set(json::jsonb #- '{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}', '{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcpConfig}', (json#>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}')::jsonb) -WHERE json#>>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig}' is not null and json#>>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}' is not null; - -- use FQN instead of name for Test Connection Definition ALTER TABLE test_connection_definition ADD fullyQualifiedName VARCHAR(256) GENERATED ALWAYS AS (json ->> 'fullyQualifiedName') STORED NOT NULL, DROP COLUMN name; + +-- Since we are not deleting the test connection defs anymore, clean it up +TRUNCATE test_connection_definition; diff --git a/bootstrap/sql/org.postgresql.Driver/v013__create_db_connection_info.sql b/bootstrap/sql/org.postgresql.Driver/v013__create_db_connection_info.sql new file mode 100644 index 00000000000..7182a390e2a --- /dev/null +++ b/bootstrap/sql/org.postgresql.Driver/v013__create_db_connection_info.sql @@ -0,0 +1,29 @@ +-- we are not using the secretsManagerCredentials +UPDATE metadata_service_entity +SET json = json::jsonb #- '{openMetadataServerConnection.secretsManagerCredentials}' +where name = 'OpenMetadata'; + +-- Rename githubCredentials to gitCredentials +UPDATE dashboard_service_entity +SET json = jsonb_set(json, '{connection,config,gitCredentials}', json#>'{connection,config,githubCredentials}') + where serviceType = 'Looker' + and json#>'{connection,config,githubCredentials}' is not null; + +-- Rename gcsConfig in BigQuery to gcpConfig +UPDATE dbservice_entity +SET json = jsonb_set(json, '{connection,config,credentials,gcpConfig}', +json#>'{connection,config,credentials,gcsConfig}') +where serviceType in ('BigQuery') + and json#>'{connection,config,credentials,gcsConfig}' is not null; + +-- Rename gcsConfig in Datalake to gcpConfig +UPDATE dbservice_entity +SET json = jsonb_set(json, '{connection,config,configSource,securityConfig,gcpConfig}', +json#>'{connection,config,configSource,securityConfig,gcsConfig}') +where serviceType in ('Datalake') + and json#>'{connection,config,configSource,securityConfig,gcsConfig}' is not null; + +-- Rename gcsConfig in dbt to gcpConfig +UPDATE ingestion_pipeline_entity +SET json = jsonb_set(json::jsonb #- '{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}', '{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcpConfig}', (json#>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}')::jsonb) +WHERE json#>>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig}' is not null and json#>>'{sourceConfig,config,dbtConfigSource,dbtSecurityConfig,gcsConfig}' is not null;