2023-02-15 21:04:23 -08:00
|
|
|
-- Unique constraint for user email address
|
|
|
|
ALTER TABLE user_entity
|
2023-02-21 00:43:45 +05:30
|
|
|
ADD UNIQUE (email);
|
|
|
|
|
|
|
|
|
|
|
|
-- Remove classificationName in BigQuery
|
|
|
|
UPDATE dbservice_entity
|
2023-02-23 15:42:40 +05:30
|
|
|
SET json = JSON_REMOVE(json, '$.connection.config.classificationName') where serviceType in ('BigQuery');
|
|
|
|
|
|
|
|
-- migrate ingestAllDatabases in postgres
|
|
|
|
UPDATE dbservice_entity de2
|
|
|
|
SET json = JSON_REPLACE(
|
|
|
|
JSON_INSERT(json,
|
|
|
|
'$.connection.config.database',
|
|
|
|
(select JSON_EXTRACT(json, '$.name')
|
|
|
|
from database_entity de
|
|
|
|
where id = (select er.toId
|
|
|
|
from entity_relationship er
|
|
|
|
where er.fromId = de2.id
|
|
|
|
and er.toEntity = 'database'
|
|
|
|
LIMIT 1
|
|
|
|
))
|
|
|
|
), '$.connection.config.ingestAllDatabases',
|
|
|
|
true
|
|
|
|
)
|
|
|
|
where de2.serviceType = 'Postgres'
|
2023-02-25 00:34:08 +00:00
|
|
|
and JSON_EXTRACT(json, '$.connection.config.database') is NULL;
|
|
|
|
|
2023-04-12 11:44:46 +02:00
|
|
|
CREATE TABLE IF NOT EXISTS storage_container_entity (
|
2023-02-25 00:34:08 +00:00
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
|
|
|
fullyQualifiedName VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.fullyQualifiedName') NOT NULL,
|
|
|
|
json JSON NOT NULL,
|
|
|
|
updatedAt BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.updatedAt') NOT NULL,
|
|
|
|
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.updatedBy') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (fullyQualifiedName)
|
|
|
|
);
|
|
|
|
|
2023-03-05 10:17:08 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS test_connection_definition (
|
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
|
|
|
name VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL,
|
|
|
|
json JSON NOT NULL,
|
|
|
|
updatedAt BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.updatedAt') NOT NULL,
|
|
|
|
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.updatedBy') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (name)
|
|
|
|
);
|
2023-03-06 14:44:16 +01:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS automations_workflow (
|
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
|
|
|
name VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL,
|
|
|
|
workflowType VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.workflowType') STORED NOT NULL,
|
|
|
|
status VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.status') STORED,
|
|
|
|
json JSON NOT NULL,
|
|
|
|
updatedAt BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.updatedAt') NOT NULL,
|
|
|
|
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.updatedBy') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (name)
|
|
|
|
);
|
2023-03-09 17:32:40 +01:00
|
|
|
|
|
|
|
-- Do not store OM server connection, we'll set it dynamically on the resource
|
|
|
|
UPDATE ingestion_pipeline_entity
|
|
|
|
SET json = JSON_REMOVE(json, '$.openMetadataServerConnection');
|
2023-03-16 09:25:30 +05:30
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS query_entity (
|
2023-04-13 09:21:16 +05:30
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
2023-03-16 09:25:30 +05:30
|
|
|
name VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL,
|
|
|
|
json JSON NOT NULL,
|
|
|
|
updatedAt BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.updatedAt') NOT NULL,
|
|
|
|
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.updatedBy') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
2023-04-13 09:21:16 +05:30
|
|
|
PRIMARY KEY (id),
|
2023-03-16 09:25:30 +05:30
|
|
|
UNIQUE(name),
|
|
|
|
INDEX name_index (name)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS temp_query_migration (
|
|
|
|
tableId VARCHAR(36)NOT NULL,
|
|
|
|
queryId VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') NOT NULL,
|
2023-04-13 09:21:16 +05:30
|
|
|
queryName VARCHAR(255) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL,
|
2023-03-16 09:25:30 +05:30
|
|
|
json JSON NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO temp_query_migration(tableId,json)
|
2023-04-13 09:21:16 +05:30
|
|
|
SELECT id,JSON_OBJECT('id',UUID(),'vote',vote,'query',query,'users',users,'checksum',checksum,'duration',duration,'name',checksum,'updatedAt',UNIX_TIMESTAMP(NOW()),'updatedBy','admin','deleted',false) as json from entity_extension d, json_table(d.json, '$[*]' columns (vote double path '$.vote', query varchar(200) path '$.query',users json path '$.users',checksum varchar(200) path '$.checksum',name varchar(255) path '$.checksum', duration double path '$.duration',queryDate varchar(200) path '$.queryDate')) AS j WHERE extension = "table.tableQueries";
|
2023-03-16 09:25:30 +05:30
|
|
|
|
2023-04-13 09:21:16 +05:30
|
|
|
INSERT INTO query_entity (json)
|
|
|
|
SELECT t.json from temp_query_migration t
|
|
|
|
ON DUPLICATE KEY UPDATE json = VALUES(json);
|
2023-03-16 09:25:30 +05:30
|
|
|
|
|
|
|
INSERT INTO entity_relationship(fromId,toId,fromEntity,toEntity,relation)
|
2023-04-13 09:21:16 +05:30
|
|
|
SELECT tmq.tableId, (select qe.id from query_entity qe where qe.name = tmq.queryName) ,"table","query",5 FROM temp_query_migration tmq;
|
2023-03-16 09:25:30 +05:30
|
|
|
|
|
|
|
DELETE FROM entity_extension WHERE id IN
|
|
|
|
(SELECT DISTINCT tableId FROM temp_query_migration) AND extension = "table.tableQueries";
|
|
|
|
|
|
|
|
DROP Table temp_query_migration;
|
2023-03-16 14:11:44 +01:00
|
|
|
|
|
|
|
-- remove the audience if it was wrongfully sent from the UI after editing the OM service
|
|
|
|
UPDATE metadata_service_entity
|
|
|
|
SET json = JSON_REMOVE(json, '$.connection.config.securityConfig.audience')
|
|
|
|
WHERE name = 'OpenMetadata' AND JSON_EXTRACT(json, '$.connection.config.authProvider') != 'google';
|
2023-03-17 16:22:41 +05:30
|
|
|
|
|
|
|
ALTER TABLE user_tokens MODIFY COLUMN expiryDate BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.expiryDate');
|
2023-03-21 10:12:49 +05:30
|
|
|
|
2023-04-13 09:21:16 +05:30
|
|
|
CREATE TABLE IF NOT EXISTS event_subscription_entity (
|
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
|
|
|
name VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.name') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
|
|
|
json JSON NOT NULL,
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (name)
|
|
|
|
-- No versioning, updatedAt, updatedBy, or changeDescription fields for webhook
|
|
|
|
);
|
|
|
|
|
|
|
|
drop table if exists alert_action_def;
|
|
|
|
drop table if exists alert_entity;
|
|
|
|
DELETE from entity_relationship where fromEntity = 'alert' and toEntity = 'alertAction';
|
2023-03-21 10:12:49 +05:30
|
|
|
|
2023-03-28 17:07:38 +02:00
|
|
|
-- create data model table
|
|
|
|
CREATE TABLE IF NOT EXISTS dashboard_data_model_entity (
|
|
|
|
id VARCHAR(36) GENERATED ALWAYS AS (json ->> '$.id') STORED NOT NULL,
|
|
|
|
fullyQualifiedName VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.fullyQualifiedName') NOT NULL,
|
|
|
|
json JSON NOT NULL,
|
|
|
|
updatedAt BIGINT UNSIGNED GENERATED ALWAYS AS (json ->> '$.updatedAt') NOT NULL,
|
|
|
|
updatedBy VARCHAR(256) GENERATED ALWAYS AS (json ->> '$.updatedBy') NOT NULL,
|
|
|
|
deleted BOOLEAN GENERATED ALWAYS AS (json -> '$.deleted'),
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
UNIQUE (fullyQualifiedName)
|
|
|
|
);
|
2023-04-04 22:45:19 +05:30
|
|
|
|
|
|
|
UPDATE dbservice_entity
|
|
|
|
SET json = JSON_INSERT(
|
|
|
|
JSON_REMOVE(json, '$.connection.config.database'),
|
|
|
|
'$.connection.config.databaseName', JSON_EXTRACT(json, '$.connection.config.database')
|
|
|
|
)
|
|
|
|
where serviceType = 'Druid'
|
2023-04-06 21:12:18 +02:00
|
|
|
and JSON_EXTRACT(json, '$.connection.config.database') is not null;
|
|
|
|
|
|
|
|
-- We were using the same jsonSchema for Pipeline Services and Ingestion Pipeline status
|
|
|
|
-- Also, we relied on the extension to store the run id
|
|
|
|
UPDATE entity_extension_time_series
|
|
|
|
SET jsonSchema = 'ingestionPipelineStatus', extension = 'ingestionPipeline.pipelineStatus'
|
|
|
|
WHERE jsonSchema = 'pipelineStatus' AND extension <> 'pipeline.PipelineStatus';
|
2023-04-11 06:28:01 -07:00
|
|
|
|
2023-04-12 11:44:46 +02:00
|
|
|
-- We are refactoring the storage service with containers. We'll remove the locations
|
|
|
|
DROP TABLE location_entity;
|
2023-04-13 18:05:44 +02:00
|
|
|
DELETE FROM entity_relationship WHERE fromEntity='location' OR toEntity='location';
|
|
|
|
TRUNCATE TABLE storage_service_entity;
|
2023-04-12 11:44:46 +02:00
|
|
|
|
|
|
|
UPDATE dbservice_entity
|
|
|
|
SET json = JSON_REMOVE(json, '$.connection.config.storageServiceName')
|
|
|
|
WHERE serviceType = 'Glue';
|
|
|
|
|
2023-04-11 06:28:01 -07:00
|
|
|
UPDATE chart_entity
|
|
|
|
SET json = JSON_REMOVE(json, '$.tables');
|