1 DatabaseUpdate
j edited this page 2023-07-02 12:57:13 +05:30

Upgrading Database to South

first time you update from a version without South you have to manually sync your db and after that initialize your database and fake all previous south transactions:

  1. if your repositroy revision is below 2327, you want to update to 2327, migrate to south and update to latest version after that
bzr pull -r2327
cd src/python-ox
bzr pull
  1. manualy sync database to current layout(see below)
  2. make sure south is installed
cd /srv/pandora
./bin/pip install South
  1. sync south db
cd /srv/pandora/pandora
./manage.py syncdb
  1. populate south history
./manage.py migrate --all --fake

Manually Syncing Database

First check for changes in the database:

cd /srv/pandora/pandora
./manage.py sqldiff -a

If you have any you can pipe the diff into dbshell to apply them. make sure nothing gets dropped that contains data.

cd /srv/pandora/pandora
./manage.py sqldiff -a | ./manage.py dbshell

Sometimes it is required to set defaults for rows. In that case you have to open dbshell and set them manually:

./manage.py dbshell
UPDATE archive_file SET info = '{}' WHERE info IS NULL;
UPDATE archive_file SET path_info = '{}' WHERE path_info IS NULL;