+fi
+if [ "$COMMAND" = "repairdb" ]; then
+ stopserver
+ ensure_postgres_running
+ dumpdata
+ # TODO: This is where we could run migration scripts to upgrade the
+ # dumped data to the new models.
+ mv /opt/planetstack/core/fixtures/initial_data.json /opt/planetstack/core/fixtures/initial_data.json-old
+ cp $BACKUP_DIR/dumpdata-latest.json /opt/planetstack/core/fixtures/initial_data.json
+ dropdb
+ createdb
+ syncdb
+fi
+if [ "$COMMAND" = "restoredb" ]; then
+ if [[ ! -f $BACKUP_DIR/dumpdata-latest.json ]]; then
+ echo There is no dumpdata to restore
+ exit
+ fi
+ stopserver
+ ensure_postgres_running
+ mv /opt/planetstack/core/fixtures/initial_data.json /opt/planetstack/core/fixtures/initial_data.json-old
+ cp $BACKUP_DIR/dumpdata-latest.json /opt/planetstack/core/fixtures/initial_data.json
+ dropdb
+ createdb
+ syncdb
+fi
+if [ "$COMMAND" = "evolvedb" -o "$COMMAND" = "migratedb" ]; then
+ stopserver
+ ensure_postgres_running
+ if [[ $DJANGO_17 ]]; then
+ migratedb
+ else
+ evolvedb
+ fi