Zbytek sync_test
This commit is contained in:
parent
5cfadf9236
commit
5abd93d27f
3 changed files with 29 additions and 14 deletions
14
Makefile_old
14
Makefile_old
|
@ -6,17 +6,3 @@ sync_prod_flatpages: venv_check
|
|||
@echo "Applying downloaded flatpages."
|
||||
./manage.py loaddata data/flat.json
|
||||
@echo "Done."
|
||||
|
||||
# Sync (with drop) test database with production database
|
||||
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
|
||||
psql mam_test -c 'DROP OWNED BY "mam-web";'
|
||||
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||
rm dump-prod.sql
|
||||
psql mam_test -c "UPDATE django_site SET name='MaMweb (test)', domain='mam-test.ks.matfyz.cz' WHERE id=1"
|
||||
@echo Done.
|
||||
|
||||
sync_test: sync_test_media sync_test_db_aggressive
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -exuo pipefail
|
||||
. make/lib.sh
|
||||
|
||||
# Prerekvizity nekontrolujeme, dokud voláme další make skripty, tak by akorát
|
||||
# vedly k víc dotazům na stejnou věc a bylo by to otravné. Pokud tu někdy bude
|
||||
# něco jiného, tak pak ať tu prerekvizity zmíněné jsou.
|
||||
|
||||
make/sync_test_db_aggressive
|
||||
make/sync_test_media
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -exuo pipefail
|
||||
. make/lib.sh
|
||||
|
||||
gimli_only
|
||||
# Teoreticky není potřeba, ale stejně jinde make skripty nejsou a pouštět to z
|
||||
# produkce nezní jako běžný stav, kromě toho to aktuálně vyrábí pomocné soubory
|
||||
# v aktuální složce (FIXME do budoucna) a to na produkci nechceme
|
||||
only_in_directory "$TESTWEB"
|
||||
|
||||
pg_dump mam_test > dump-test-`date +"%Y%m%d_%H%M"`.sql
|
||||
pg_dump -Fc mam_prod > dump-prod.sql
|
||||
psql mam_test -c 'DROP OWNED BY "mam-web";'
|
||||
pg_restore -c --if-exists -d mam_test dump-prod.sql
|
||||
rm dump-prod.sql
|
||||
psql mam_test -c "UPDATE django_site SET name='MaMweb (test)', domain='mam-test.ks.matfyz.cz' WHERE id=1"
|
||||
|
Loading…
Reference in a new issue