Question
Virtusa
US
Last activity: 16 Jan 2020 14:29 EST
Delete all rules in an application
How can we delete all rules/data in an applications?
1. All rules
2. All classes
3. All data instances like AccesGroup , WorkGroup , DSS etc
4. All work objects and its attachments.
Refactor wizard for ruleset/class only deletes rules and class and not corresponding data instances like AccessGroup etc .
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Is the Application (A) in Development environment or (B) a downstream environment where the Application has been deployed using a R-A-P?
With (B) you would start with the SystemManagement Service Package. First run the "GET" RestorePoint Service with no id. Find the name of the restore point created when the R-A-P was installed. Next run the "POST" Rollback Service providing the restore point name (id). For attachLog say "true". For action say "SystemRollback".
Attempting (A) would be very complex if wanting to pin-point rules and data in shared tables that apply to one particular application and not others. Data tables created specifically for the application would be simple to truncate.
-
naveen bandaru
Virtusa
US
Hi Lee ,
i am looking for scenario A where we create a new application from wizard , by using refactor class and ruleset i was able to delete most of the rules except following . So for this rules in screen shot we have to open them and delete individually ?
Virtusa
US
Hi Lee ,
For (B) , if we do roll back to the restore point , will the other data be lost ? for example
1. Deploy RAP -1
2 Deploy RAP - 2
Now If we roll back to the restore point of RAP -1 , RAP -2 data is lost ?
Pegasystems Inc.
US
Yes. If you create RAP - 2 after RAP - 1, then rollback to RAP - 1, the rules added by RAP -2 are deleted.
If concerned about loss of data, you have different options.
(1) A VM's directory can be copied. When launching it, say you "copied it" as opposed to "moved it". Switch VMs
(2) Start with a new VM before creating each application. Switch VMs.
(3) Or you could get fancy and backup the database itself after working on an application saving to a unique file name. Later restore the database when you want to come back to it (wiping out what was in the database previously). This takes time to do this however and, of course, is something you should ONLY use when prototyping.
NOTE: the script below also remove the PegaTemp directory. This is something you would do if wanting to get completely back to some "starting point" before any RAPs have been installed.
/////////////////////////////////// CREATE ////////////////////////////
set -x
cd /opt/PostgreSQL/9.6/bin
./pg_dump -f "$HOME/pega731db_pegadata.backup" -U pega -d pega -Fc -v -b --schema "pegadata"
./pg_dump -f "$HOME/pega731db_pegarules.backup" -U pega -d pega -Fc -v -b --schema "pegarules"
/////////////////////////////////// RESTORE ////////////////////////////
set -x
cd /opt/PostgreSQL/9.6/bin
Yes. If you create RAP - 2 after RAP - 1, then rollback to RAP - 1, the rules added by RAP -2 are deleted.
If concerned about loss of data, you have different options.
(1) A VM's directory can be copied. When launching it, say you "copied it" as opposed to "moved it". Switch VMs
(2) Start with a new VM before creating each application. Switch VMs.
(3) Or you could get fancy and backup the database itself after working on an application saving to a unique file name. Later restore the database when you want to come back to it (wiping out what was in the database previously). This takes time to do this however and, of course, is something you should ONLY use when prototyping.
NOTE: the script below also remove the PegaTemp directory. This is something you would do if wanting to get completely back to some "starting point" before any RAPs have been installed.
/////////////////////////////////// CREATE ////////////////////////////
set -x
cd /opt/PostgreSQL/9.6/bin
./pg_dump -f "$HOME/pega731db_pegadata.backup" -U pega -d pega -Fc -v -b --schema "pegadata"
./pg_dump -f "$HOME/pega731db_pegarules.backup" -U pega -d pega -Fc -v -b --schema "pegarules"
/////////////////////////////////// RESTORE ////////////////////////////
set -x
cd /opt/PostgreSQL/9.6/bin
./psql psql -h localhost -U pega -d pega -c "DROP SCHEMA pegadata CASCADE"
./psql psql -h localhost -U pega -d pega -c "DROP SCHEMA pegarules CASCADE"
./pg_restore -h localhost -U pega -d pega "$HOME/pega731db_pegadata.backup"
./pg_restore -h localhost -U pega -d pega "$HOME/pega731db_pegarules.backup"
# sudo rm -f /opt/tomcat/temp/StaticContent/global/ServiceExport/*
sudo rm -rf /opt/tomcat/temp/*
/opt/tomcat/bin/shutdown.sh
Synechron
US
If RAP-2 contained data instances (Access Groups, Operator ID), would those be deleted too or just the rules when we rollback to RAP-1?
Pegasystems Inc.
US
According to Help, a rollback looks at history records to decide what to remove.
8>< - - - - - - - rollback help - - - - - - - ><8
According to Help, a rollback looks at history records to decide what to remove.
8>< - - - - - - - rollback help - - - - - - - ><8
Roll back
When you roll back to a restore point, the Pega 7 Platform uses history records to return most of the system to the restore point state. Changes to the following items do not generate history records and therefore will not be rolled back using the roll back feature:
- SQL changes
- Java .jar imports
- Some custom data instances: When you configure the data instance in the rule form, you can specify not to generate a history record. If the data instance does not generate a history record, changes to the data instance cannot be rolled back.
Pegasystems Inc.
US
If you have direct access to the database, perhaps through Connect-SQL rules, or can provide a script that a DBA can execute (preferred), you can delete every row associated to a ruleset in your application regardless being a data class or a rule class.
Every database would have a way to search for columns by name regardless what table they are in.
For postgresql you would use:
select t.table_schema, t.table_name, c.column_name
from information_schema.tables t
inner join information_schema.columns c on c.table_name = t.table_name
and c.table_schema = t.table_schema
where c.column_name in ('pyrulesetname','pyruleset')
and t.table_schema not in ('information_schema', 'pg_catalog')
and t.table_type = 'BASE TABLE'
order by t.table_schema;
There are 100 tables in Pega 7.3.1.
In Excel, generate a delete statement for every table.
Plus generate a single-quoted, comma-delimited list of the rulesets in your Application by copying them from your Operator profile.
The end goal is a statement for every table such as:
DELETE FROM pr_operators WHERE pyRuleSetName IN ('Claim','ClaimInt','XYZ','XYZInt')
That should get the job done.