summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2013-12-03 12:51:04 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-12-09 18:58:26 +0000
commit6936faed8d94f3a2ab4055049cd27d02d8229003 (patch)
treee23e66c4a135fd71f21b842ba03bf655e2034a4c /bin
parent2d37a1731a2b681bc976f3f391d65abb7745b6f9 (diff)
downloadbitbake-contrib-6936faed8d94f3a2ab4055049cd27d02d8229003.tar.gz
toaster: migrate orm models to South
As Toaster advances, database schema alteration will force users to delete old versions and lose all data collected. In order to prevent this, and to allow database updates to happen without having to delete old data, we use South to handle migrations for the ORM application which stores the Toaster data. [YOCTO #5559] Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/toaster16
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/toaster b/bin/toaster
index 7e51014b7..fc59fe554 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -40,9 +40,16 @@ function webserverStartAll()
{
retval=0
python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1
+ python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=2
if [ $retval -eq 1 ]; then
echo "Failed db sync, stopping system start" 1>&2
- else
+ elif [ $retval -eq 2 ]; then
+ echo -e "\nError on migration, trying to recover... \n"
+ python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial --fake
+ retval=0
+ python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
+ fi
+ if [ $retval -eq 0 ]; then
python $BBBASEDIR/lib/toaster/manage.py runserver 0.0.0.0:8000 </dev/null >${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid
fi
return $retval
@@ -92,6 +99,13 @@ if ! echo "import django; print (1,5) == django.VERSION[0:2]" | python 2>/dev/nu
return 2
fi
+if ! echo "import south; print [0,8,4] == map(int,south.__version__.split(\".\"))" | python 2>/dev/null | grep True >/dev/null; then
+ echo -e "This program needs South 0.8.4. Please install with\n\nsudo pip install south==0.8.4"
+ return 2
+fi
+
+
+
# Determine the action. If specified by arguments, fine, if not, toggle it