2023-06-11 03:38:05 +02:00
-- 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
2023-06-26 15:06:45 +05:30
SET json = jsonb_set ( json : : jsonb #- '{connection,config,githubCredentials}', '{connection,config,gitCredentials}', json#>'{connection,config,githubCredentials}')
2023-06-11 03:38:05 +02:00
where serviceType = ' Looker '
and json #>'{connection,config,githubCredentials}' is not null;
-- Rename gcsConfig in BigQuery to gcpConfig
UPDATE dbservice_entity
2023-06-26 15:06:45 +05:30
SET json = jsonb_set ( json : : jsonb #- '{connection,config,credentials,gcsConfig}', '{connection,config,credentials,gcpConfig}',
2023-06-11 03:38:05 +02:00
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
2023-06-26 15:06:45 +05:30
SET json = jsonb_set ( json : : jsonb #- '{connection,config,configSource,securityConfig,gcsConfig}', '{connection,config,configSource,securityConfig,gcpConfig}',
2023-06-11 03:38:05 +02:00
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;
2023-06-15 14:44:48 +05:30
-- Rename dashboardUrl in dashboard_entity to sourceUrl
UPDATE dashboard_entity
SET json = jsonb_set ( json : : jsonb #- '{dashboardUrl}' , '{sourceUrl}',
json #>'{dashboardUrl}')
where json #>'{dashboardUrl}' is not null;
-- Rename chartUrl in chart_entity to sourceUr
UPDATE chart_entity
SET json = jsonb_set ( json : : jsonb #- '{chartUrl}' , '{sourceUrl}',
json #>'{chartUrl}')
where json #>'{chartUrl}' is not null;
-- Rename pipelineUrl in pipeline_entity to sourceUrl
UPDATE pipeline_entity
SET json = jsonb_set ( json : : jsonb #- '{pipelineUrl}' , '{sourceUrl}',
json #>'{pipelineUrl}')
where json #>'{pipelineUrl}' is not null;
-- Rename taskUrl in pipeline_entity to sourceUrl
UPDATE pipeline_entity
SET json = jsonb_set (
json : : jsonb - ' tasks ' ,
' {tasks} ' ,
(
SELECT jsonb_agg (
jsonb_build_object (
' name ' , t - > > ' name ' ,
' sourceUrl ' , t - > > ' taskUrl ' ,
' taskType ' , t - > > ' taskType ' ,
' description ' , t - > > ' description ' ,
' displayName ' , t - > > ' displayName ' ,
' fullyQualifiedName ' , t - > > ' fullyQualifiedName ' ,
' downstreamTasks ' , ( t - > ' downstreamTasks ' ) : : jsonb ,
' tags ' , ( t - > > ' tags ' ) : : jsonb ,
' endDate ' , t - > > ' endDate ' ,
' startDate ' , t - > > ' startDate ' ,
' taskSQL ' , t - > > ' taskSQL '
)
)
FROM jsonb_array_elements ( json - > ' tasks ' ) AS t
)
) ;
2023-06-16 13:18:12 +05:30
-- Modify migrations for service connection of postgres and mysql to move password under authType
UPDATE dbservice_entity
SET json = jsonb_set (
json #-'{connection,config,password}',
' {connection,config,authType} ' ,
jsonb_build_object ( ' password ' , json #>'{connection,config,password}')
2023-06-19 03:13:05 -07:00
)
2023-06-16 13:18:12 +05:30
WHERE serviceType IN ( ' Postgres ' , ' Mysql ' )
and json #>'{connection,config,password}' is not null;
2023-06-21 08:35:50 +02:00
-- Clean old test connections
TRUNCATE automations_workflow ;
2023-06-20 15:16:45 +05:30
-- Remove sourceUrl in pipeline_entity from DatabricksPipeline & Fivetran
UPDATE pipeline_entity
SET json = json : : jsonb #- '{sourceUrl}'
where json #> '{serviceType}' in ('"DatabricksPipeline"','"Fivetran"');
-- Remove sourceUrl in dashboard_entity from Mode
UPDATE dashboard_entity
SET json = json : : jsonb #- '{sourceUrl}'
where json #> '{serviceType}' in ('"Mode"');
2023-06-26 00:33:44 -07:00
CREATE TABLE IF NOT EXISTS SERVER_CHANGE_LOG (
installed_rank SERIAL ,
version VARCHAR ( 256 ) PRIMARY KEY ,
migrationFileName VARCHAR ( 256 ) NOT NULL ,
checksum VARCHAR ( 256 ) NOT NULL ,
installed_on TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ;
CREATE TABLE IF NOT EXISTS SERVER_MIGRATION_SQL_LOGS (
version VARCHAR ( 256 ) NOT NULL ,
sqlStatement VARCHAR ( 10000 ) NOT NULL ,
checksum VARCHAR ( 256 ) PRIMARY KEY ,
executedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ;