delete policy violations before component

Signed-off-by: Arjav <arjavdongaonkar@gmail.com>
This commit is contained in:
Arjav 2025-10-13 08:52:17 +05:30
parent db4c4d1503
commit 20929ed18e

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)