Last active
January 26, 2018 21:21
-
-
Save mccun934/996bfcd7c118769cb6c0938a044b97dc to your computer and use it in GitHub Desktop.
Truncate all task related tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "" | |
echo "DELETING All task data" | |
echo "" | |
TABLE_COUNTS="select count(*) as foreman_tasks_tasks from foreman_tasks_tasks; | |
select count(*) as dynflow_execution_plans from dynflow_execution_plans; | |
select count(*) as dynflow_actions from dynflow_actions; | |
select count(*) as dynflow_steps from dynflow_steps;" | |
echo "" | |
echo "Table counts before:" | |
echo $TABLE_COUNTS | sudo -i -u postgres psql -d foreman | |
echo "Deleting foreman_tasks_tasks" | |
FT="TRUNCATE TABLE dynflow_envelopes,dynflow_delayed_plans,dynflow_steps,dynflow_actions,dynflow_execution_plans,foreman_tasks_locks,foreman_tasks_tasks;" | |
sudo -i -u postgres psql -d foreman -c "$FT" | |
echo "Done." | |
echo "Table counts after:" | |
echo $TABLE_COUNTS | sudo -i -u postgres psql -d foreman |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment