|
|
# clean DB for creating an init DB
|
|
|
|
|
|
```
|
|
|
# export database without cache
|
|
|
pg_dump --clean --exclude-table-data="cache*" --if-exists framaforms > /tmp/tmp/framaforms_2018_04_02.sql
|
|
|
# prepare a clean temp database
|
|
|
# clean the temp database
|
|
|
dropdb betaforms
|
|
|
# create temp database (here "betaforms")
|
|
|
createdb --encoding=UTF8 --owner=betaforms betaforms
|
|
|
# import exported data into temp database
|
|
|
psql -U betaforms -W -h 127.0.0.1 betaforms < /tmp/tmp/framaforms_2018_04_02.sql
|
|
|
```
|
|
|
Then **very important step** before using drush on database: be sure that we will work on the desired database
|
|
|
```
|
|
|
cd /var/www/betaforms
|
|
|
drush status
|
|
|
```
|
|
|
|
|
|
# clean temporary DB for creating an init DB
|
|
|
|
|
|
```sql
|
|
|
# clean all forms nodes (takes ~1mn for 1000 nodes)
|
|
|
# enable module devel-generate to be able to use "drush genc"
|
|
|
drush pm-enable devel_generate -y
|
|
|
# clean all forms nodes (takes ~1mn for 1000 nodes). It's usefull cause it remove forms and reference to this form (but we could use some SQL queries instead)
|
|
|
drush genc --kill --types=form1 0 0
|
|
|
# disable devel-generate module
|
|
|
drush pm-disable devel_generate
|
|
|
|
|
|
#sql to empty DB
|
|
|
TRUNCATE "batch", "cache", "cache_admin_menu", "cache_block", "cache_bootstrap", "cache_field", "cache_filter", "cache_form", "cache_image", "cache_libraries", "cache_menu", "cache_page", "cache_panels", "cache_path", "cache_rules", "cache_token", "cache_update", "cache_views", "cache_views_data", "flood", "history", "pgbar_webform_submissions_static", "search_dataset", "search_index", "search_total", "sessions", "themekey_ui_node_theme", "watchdog", "webform", "webform_component", "webform_conditional", "webform_conditional_actions", "webform_conditional_rules", "webform_confirm_email", "webform_confirm_email_code", "webform_confirm_email_confirmation_emails", "webform_confirmation", "webform_emails", "webform_last_download", "webform_report", "webform_roles", "webform_submissions", "webform_submitted_data", "webform_validation_rule", "webform_validation_rule_components";
|
... | ... | |