Answers.Body: <p>There is no import/export function as far as I know but.....</p>
  <p>your rules will be saved in a few tables:</p>
  <ul>
  <li><strong>civirule_rule</strong> will contain your rules</li>
  <li><strong>civirule_rule_action</strong> will contain the combination of actions in your rules</li>
  <li><strong>civirule_rule_condition</strong> will contain the combination of conditions in your rules</li>
  <li><strong>civirule_rule_log</strong> will contain the logs of your executed rules</li>
  <li><strong>civirule_rule_tag</strong> will contain the tags of your rules</li>
  </ul>
  <p>You can save these tables before you upgrade and then later restore BUT you would have to make sure that you check the ID's of actions and conditions! So to be on the safe side I would save the tables <strong>civirule_action</strong> and <strong>civirule_condition</strong> too so you can compare after the upgrade.</p>
  <p>Also, be aware that if you have any delayed rules you have to check the <strong>civicrm_queue_item</strong> table and execute the cron job for delayed rules until there are no more items left BEFORE you upgrade.</p>
  <p>Alternatively you can either develop an import/export function yourself or fund a CiviCRM expert to create that function in the CiviRules extension?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-21T05:46:50.980Z
Answers.Text: Thank you!  This was very clear and super, super helpful.  Just a note - civirule_trigger should also be saved, because civirule_rule references the trigger IDs in civirule_trigger.
Answers.UserDisplayName: richardsplayground
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-03-08T16:58:04.283Z
Answers.LastActivityDate: 2021-03-08T16:58:04.283Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p><a href="https://lab.civicrm.org/extensions/civirules/-/blob/master/README.md" rel="nofollow noreferrer">https://lab.civicrm.org/extensions/civirules/-/blob/master/README.md</a> has a reference to &quot;SAVE YOUR EXISTING RULES FIRST.&quot; I realize that regarded upgrading from 1.x but I'm interested because I ran into a problem upgrading from 2.19 straight to 2.22 and, if possible, would like to back up just the rules before probing further. Is there a way to save / back-up and later restore just the rules?</p>
  
Tags: <civirules>
Title: Saving CiviRules Rules
ThreadText: # Saving CiviRules Rules
  
  (Asked by: username_0 on 2021-03-08)
  
  <https://lab.civicrm.org/extensions/civirules/-/blob/master/README.md> has a reference to "SAVE YOUR EXISTING RULES FIRST." I realize that regarded upgrading from 1.x but I'm interested because I ran into a problem upgrading from 2.19 straight to 2.22 and, if possible, would like to back up just the rules before probing further. Is there a way to save / back-up and later restore just the rules?
  
  **Tags:** civirules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-03-08. Score: 3 | Accepted answer
  
  There is no import/export function as far as I know but.....
  
  your rules will be saved in a few tables:
  
  * **civirule\_rule** will contain your rules
  * **civirule\_rule\_action** will contain the combination of actions in your rules
  * **civirule\_rule\_condition** will contain the combination of conditions in your rules
  * **civirule\_rule\_log** will contain the logs of your executed rules
  * **civirule\_rule\_tag** will contain the tags of your rules
  
  You can save these tables before you upgrade and then later restore BUT you would have to make sure that you check the ID's of actions and conditions! So to be on the safe side I would save the tables **civirule\_action** and **civirule\_condition** too so you can compare after the upgrade.
  
  Also, be aware that if you have any delayed rules you have to check the **civicrm\_queue\_item** table and execute the cron job for delayed rules until there are no more items left BEFORE you upgrade.
  
  Alternatively you can either develop an import/export function yourself or fund a CiviCRM expert to create that function in the CiviRules extension?
  
  > **Comments:**
  > **username_2**: Thank you!  This was very clear and super, super helpful.  Just a note - civirule_trigger should also be saved, because civirule_rule references the trigger IDs in civirule_trigger.  
  
  ---
  
  