fix migrate_postgres

master
agp8x 2019-12-05 23:32:03 +01:00
parent 72d50bf545
commit 8304f30cb6
1 changed files with 6 additions and 6 deletions

View File

@ -1,11 +1,11 @@
# start old postgres, dump data
sed -i 's/postgres:12-alpine/postgres:10-alpine/' docker-compose.yml
docker-compose exec db pg_dumpall -U partdoc > pgdump.tmp
docker-compose exec web python3 manage.py dumpdata -o /app/djangodump0.json --natural-foreign --exclude auth.permission --exclude contenttypes --indent 1
# migrate to new postgres, import data
docker-compose stop db
docker-compose down
mv pgdata __pgdata__10
sed -i 's/postgres:10-alpine/postgres:12-alpine/' docker-compose.yml
docker-compose up -d
docker-compose exec -T db psql -U partdoc < pgdump.tmp
docker-compose down
docker-compose up -d
rm pgdump.tmp
docker-compose exec web python3 manage.py migrate
docker-compose exec web python3 manage.py loaddata /app/djangodump0.json
docker-compose exec web rm /app/djangodump0.json