From: Scott Baker Date: Thu, 18 Sep 2014 05:19:54 +0000 (-0700) Subject: run migrate for django 1.7 or evolve for django 1.5 X-Git-Url: http://git.onelab.eu/?p=plstackapi.git;a=commitdiff_plain;h=a99cbefc194c3f107848bf3fdc74b19ea809d865 run migrate for django 1.7 or evolve for django 1.5 --- diff --git a/opencloud.spec b/opencloud.spec index 4d72a55..5831006 100644 --- a/opencloud.spec +++ b/opencloud.spec @@ -1,7 +1,7 @@ Summary: OpenCloud core services Name: opencloud -Version: 1.0.25 -Release: 8 +Version: 1.0.26 +Release: 7 License: GPL+ Group: Development/Tools Source0: %{_tmppath}/%{name}-%{version}.tar.gz @@ -29,7 +29,7 @@ requires: GeoIP # Empty section. %pre -#pip-python install django==1.5 +pip-python install django==1.7 pip-python install djangorestframework pip-python install markdown # Markdown support for the browseable API. pip-python install pyyaml # YAML content-type support. @@ -119,10 +119,9 @@ if [ "$1" == 1 ] ; then echo "NEW INSTALL - initializing database" /opt/planetstack/scripts/opencloud initdb else - echo "UPGRADE - doing evolution" + # scripts/opencloud will choose evolve or migrate depending on django version + echo "UPGRADE - doing evolution/migration" /opt/planetstack/scripts/opencloud evolvedb - #echo "UPGRADE - doing migration" - #/opt/planetstack/scripts/opencloud migratedb fi # start the server diff --git a/planetstack/scripts/opencloud b/planetstack/scripts/opencloud index ff6eefc..b307e66 100755 --- a/planetstack/scripts/opencloud +++ b/planetstack/scripts/opencloud @@ -134,15 +134,14 @@ if [ "$COMMAND" = "restoredb" ]; then createdb syncdb fi -if [ "$COMMAND" = "evolvedb" ]; then +if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then stopserver ensure_postgres_running - evolvedb -fi -if [ "$COMMAND" = "migratedb" ]; then - stopserver - ensure_postgres_running - migratedb + if [[ $DJANGO_17 ]]; then + migratedb + else + evolvedb + fi fi if [ "$COMMAND" = "resetdb" ]; then stopserver