diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql index 804a2d3d65f..6ce1afd5502 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql @@ -1569,4 +1569,8 @@ CREATE VIEW `cloud`.`user_view` AS left join `cloud`.`async_job` ON async_job.instance_id = user.id and async_job.instance_type = 'User' - and async_job.job_status = 0; \ No newline at end of file + and async_job.job_status = 0; + +-- Remove snapshot references if primary storage pool has been removed, see github issue #7093 +DELETE FROM `cloud`.`snapshot_store_ref` +WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);