Compare commits

...

6 commits

Author SHA1 Message Date
Niklas
db7198805c
Merge pull request #5402 from arjavdongaonkar/fix/team-delete 2025-10-13 21:49:52 +02:00
Niklas
a009379079
Merge pull request #5395 from arjavdongaonkar/fix/project-batch-delete 2025-10-13 21:48:30 +02:00
Arjav
aa5956e5c7 revert policy query
Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
2025-10-13 20:53:25 +05:30
Arjav
645c710d7a delete NOTIFICATIONRULE_TEAMS before deleting teams
Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
2025-10-13 20:53:25 +05:30
Arjav
20929ed18e delete policy violations before component
Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
2025-10-13 20:53:25 +05:30
Arjav
b305b224ed delete policy violations before component
Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
2025-10-13 13:43:28 +05:30
2 changed files with 10 additions and 6 deletions

View file

@ -1074,6 +1074,12 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
);
executeAndCloseWithArray(sqlQuery, queryParameter);
sqlQuery = pm.newQuery(JDOQuery.SQL_QUERY_LANGUAGE, """
DELETE FROM "POLICYVIOLATION" WHERE "PROJECT_ID" = ANY(?);
""".replace("= ANY(?)", inExpression)
);
executeAndCloseWithArray(sqlQuery, queryParameter);
// Deletion with CTEs does not work with H2, but verified on Postgres and MS SQL Server
if (!DbUtil.isH2()) {
if (DbUtil.isPostgreSQL()) {
@ -1186,12 +1192,6 @@ final class ProjectQueryManager extends QueryManager implements IQueryManager {
);
executeAndCloseWithArray(sqlQuery, queryParameter);
sqlQuery = pm.newQuery(JDOQuery.SQL_QUERY_LANGUAGE, """
DELETE FROM "POLICYVIOLATION" WHERE "PROJECT_ID" = ANY(?);
""".replace("= ANY(?)", inExpression)
);
executeAndCloseWithArray(sqlQuery, queryParameter);
sqlQuery = pm.newQuery(JDOQuery.SQL_QUERY_LANGUAGE, """
DELETE FROM "POLICY_PROJECTS" WHERE "PROJECT_ID" = ANY(?);
""".replace("= ANY(?)", inExpression)

View file

@ -1542,6 +1542,10 @@ public class QueryManager extends AlpineQueryManager {
final Query<?> aclDeleteQuery = pm.newQuery(JDOQuery.SQL_QUERY_LANGUAGE, """
DELETE FROM "PROJECT_ACCESS_TEAMS" WHERE "PROJECT_ACCESS_TEAMS"."TEAM_ID" = ?""");
executeAndCloseWithArray(aclDeleteQuery, team.getId());
final Query<?> notificationRuleQuery = pm.newQuery(JDOQuery.SQL_QUERY_LANGUAGE, """
DELETE FROM "NOTIFICATIONRULE_TEAMS" WHERE "NOTIFICATIONRULE_TEAMS"."TEAM_ID" = ?""");
executeAndCloseWithArray(notificationRuleQuery, team.getId());
}
pm.deletePersistent(team);