forked from roundware/roundware-server
-
Notifications
You must be signed in to change notification settings - Fork 4
Postgresql Migration Process Notes
Halsey Burgund edited this page Jan 22, 2016
·
4 revisions
This page is to help figure out the best process for upgrading from the MySQL version of RW to the Postgresql version. The goal is to provide a reasonable upgrade path that migrates the codebase and existing databases to the new Postgresql-based system.
The primary code for this upgrade is in thespeaker-polygon branch of the LostItem fork of Roundware:
https://github.com/LostItem/roundware-server/tree/feature/speaker-polygons
- Dump data to fixture using django
dumpdatafrom most recent MySQL-based commit - Update to initial Postgres commit (i.e. no schema changes yet) update dependencies and
loaddatafixture - Update to newest Postgres commit and perform data and schema migrations
- dump data from current production install
sudo su - roundware -c "/var/www/roundware/source/roundware/manage.py dumpdata rw > ~/rw-pre-postgres.json"
-
git checkout developc71270b (will create tag for proper commit:pre-postgres) vagrant up- update server to initial postgres version before any schema changes:
git checkout psql-conversion[75bb793] - vagrant ssh
- install dependencies (should these be incorporated into the code for the tag and run using vagrant provision?)
sudo apt-get install binutils libproj-dev gdal-bin postgresql-server-dev-9.3 postgresql-9.3-postgis-2.1 libgdal-dev
sudo pip install psycopg2 geopy
(should we include pip requirements updates in this commit so only have to run pip install -r requirements/common.txt?)
-
vagrant provision(mainly/exclusively to perform postgres config stuff; manage.py migrate needs to be run as well) - import dumped db into postgres db:
python manage.py loaddata rw-pre-postgres.json - update to
feature/speaker-polygonsbranch:git checkout feature/speaker-polygons(need to create specific commit tag once code is cleaned up) - run pip installs:
pip install -r requirements/common.txt --upgrade - apply new migrations:
python manage.py migrate ./runserver.sh
- update to commit with schema clean-up migrations and admin changes:
git checkout postgres-final** removing speaker fields:mindistancemaxdistancelatitudelongitudefrommodels.pyandadmin.py