Skip to content

Commit ac25417

Browse files
author
toni.zamparetti
committed
fix in issue: delete an account belonging to a deleted project
1 parent ce2d890 commit ac25417

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

engine/schema/src/main/java/com/cloud/projects/dao/ProjectAccountDaoImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ protected ProjectAccountDaoImpl() {
5252
ProjectAccountSearch = createSearchBuilder();
5353
ProjectAccountSearch.and("projectId", ProjectAccountSearch.entity().getProjectId(), SearchCriteria.Op.EQ);
5454
ProjectAccountSearch.and("accountId", ProjectAccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
55-
ProjectAccountSearch.and("userId", ProjectAccountSearch.entity().getUserId(), Op.NULL);
5655
ProjectAccountSearch.done();
5756

5857

engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,7 @@ WHERE rule = 'quotaStatement' AND NOT EXISTS(SELECT 1 FROM cloud.role_permission
211211

212212
-- Add description for secondary IP addresses
213213
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.nic_secondary_ips', 'description', 'VARCHAR(2048) DEFAULT NULL');
214+
215+
-- Normalization of project accounts for deleted projects
216+
217+
DELETE pa FROM project_account pa JOIN projects p ON pa.project_id = p.id WHERE p.removed IS NOT NULL AND pa.user_id IS NOT NULL;

0 commit comments

Comments
 (0)