Makefile: Přidána agresivní varianta pro sync_test_db
Vyrobil Pavel
This commit is contained in:
parent
54ae948662
commit
1b2f1dbc34
1 changed files with 14 additions and 2 deletions
16
Makefile
16
Makefile
|
@ -117,12 +117,24 @@ sync_test_db:
|
||||||
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
||||||
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||||
pg_dump -Fc mam_prod > dump-prod.sql
|
pg_dump -Fc mam_prod > dump-prod.sql
|
||||||
pg_restore -c -d mam_test dump-prod.sql
|
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||||
|
rm dump-prod.sql
|
||||||
|
@echo Done.
|
||||||
|
|
||||||
|
# Aggresive variant: destroy original mam_test db with 'DROP OWNED BY "mam-web";'
|
||||||
|
sync_test_db_aggressive:
|
||||||
|
@if [ ${USER} != "mam-web" ]; then echo "Only possible by user mam-web"; exit 1; fi
|
||||||
|
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||||
|
pg_dump -Fc mam_prod > dump-prod.sql
|
||||||
|
@# I am not sure which shell is used, so I am calling bash to make sure
|
||||||
|
bash -c "psql mam_test <<< 'DROP OWNED BY \"mam-web\";'"
|
||||||
|
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||||
rm dump-prod.sql
|
rm dump-prod.sql
|
||||||
@echo Done.
|
@echo Done.
|
||||||
|
|
||||||
# Sync test with production
|
# Sync test with production
|
||||||
sync_test: sync_test_media sync_test_db
|
# HACK ALERT: using aggressive variant, due to the schemas being too different.
|
||||||
|
sync_test: sync_test_media sync_test_db_aggressive
|
||||||
|
|
||||||
|
|
||||||
# Sync media directory with atrey. Useful for local development with production database
|
# Sync media directory with atrey. Useful for local development with production database
|
||||||
|
|
Loading…
Reference in a new issue