From d42783fbe09c1c64c649968cbb9bf7113486ee5c Mon Sep 17 00:00:00 2001 From: Sriharsha Chintalapani Date: Thu, 30 Jun 2022 06:10:26 -0700 Subject: [PATCH] Fix #5415 - Add migrations (#5767) * Add migrations * Migration Extension * removed repeated code Co-authored-by: ulixius9 --- .../v002__create_db_connection_info.sql | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/bootstrap/sql/com.mysql.cj.jdbc.Driver/v002__create_db_connection_info.sql b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v002__create_db_connection_info.sql index 408af2b5436..42c3de052c2 100644 --- a/bootstrap/sql/com.mysql.cj.jdbc.Driver/v002__create_db_connection_info.sql +++ b/bootstrap/sql/com.mysql.cj.jdbc.Driver/v002__create_db_connection_info.sql @@ -43,3 +43,35 @@ ADD INDEX updated_at_index (updatedAt); CREATE TABLE task_sequence (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)); INSERT INTO task_sequence VALUES (0); + + +DELETE from ingestion_pipeline_entity where 1=1; + +UPDATE dbservice_entity +SET json = JSON_INSERT( + JSON_REMOVE(json, '$.connection.config.database'), + '$.connection.config.databaseSchema', + JSON_EXTRACT(json, '$.connection.config.database') + ) where serviceType in ('Mysql','Hive','Presto','Trino','Clickhouse','SingleStore','MariaDB','Db2','Oracle'); + +UPDATE dbservice_entity +SET json = JSON_REMOVE(json, '$.connection.config.database' + ,'$.connection.config.username' + ,'$.connection.config.projectId' + ,'$.connection.config.database' + ,'$.connection.config.enablePolicyTagImport') +WHERE serviceType = 'BigQuery'; + +UPDATE dbservice_entity +SET json = JSON_REMOVE(json, '$.connection.config.database') +WHERE serviceType in ('Athena','Databricks'); + +UPDATE dbservice_entity +SET json = JSON_REMOVE(json, '$.connection.config.supportsProfiler', '$.connection.config.pipelineServiceName') +WHERE serviceType = 'Glue'; + +UPDATE dashboard_service_entity +SET json = JSON_REMOVE(json, '$.connection.config.dbServiceName') +WHERE serviceType in ('Metabase','Superset','Tableau'); + +DELETE FROM pipeline_service_entity WHERE 1=1; \ No newline at end of file