Fix: bug in migration when removin sample data services (#10032)

This commit is contained in:
Nahuel 2023-01-31 16:11:09 +01:00 committed by GitHub
parent c101a6fd36
commit da9b534194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -9,13 +9,23 @@ SET json = JSON_INSERT(
) where serviceType in ('BigQuery');
-- Deprecate SampleData db service type
-- * Delete ingestion pipelines associated to the services
DELETE ipe
FROM ingestion_pipeline_entity ipe
INNER JOIN entity_relationship er
ON (
er.toId = ipe.id
AND fromEntity = "databaseService"
AND fromId IN (SELECT id FROM dbservice_entity de WHERE serviceType = 'SampleData')
);
-- * Delete relationships
DELETE er
FROM entity_relationship er
JOIN dbservice_entity db
ON db.id = er.fromId
OR db.id = er.toId
WHERE db.serviceType = 'SampleData';
-- * Delete services
DELETE FROM dbservice_entity where serviceType = 'SampleData';
-- Delete supportsUsageExtraction from vertica

View File

@ -8,11 +8,20 @@ where serviceType in ('BigQuery')
and json#>'{connection,config,tagCategoryName}' is not null;
-- Deprecate SampleData db service type
-- * Delete ingestion pipelines associated to the services
DELETE FROM ingestion_pipeline_entity ipe
USING entity_relationship er
WHERE (
er.toId = ipe.id
AND fromEntity = 'databaseService'
AND fromId IN (SELECT id FROM dbservice_entity de WHERE serviceType = 'SampleData')
);
-- * Delete relationships
DELETE FROM entity_relationship er
USING dbservice_entity db
WHERE (db.id = er.fromId OR db.id = er.toId)
AND db.serviceType = 'SampleData';
-- * Delete services
DELETE FROM dbservice_entity WHERE serviceType = 'SampleData';
-- Delete supportsUsageExtraction from vertica