SA-migrate in pkgdb
SA-migrate in pkgdb
create db upgrade
% manage_db script "Add app table"
edit script
test script
% manage_db test
commit
guidelines
update DB in small steps
comment
merge
check if there are conflicting db updates in branch you are merging into - look for same update version numbers
conflicting changes in branch you are merging into has to apply before your changes
dont merge your conflicting changes - append them as new update and revise them - updates that are now applying before yours may do unexpected changes
create db
from dump
usage
download dump, create db from it, call upgrade
switch to new dumps
on production machine
install 0.5.x update
that should install sa-migrate
apply all updates in update-schema
upgrade db using migrate
create dump
replace available dumps
start using migrate for whole development
from model
% tg-admin sql create
use DDL() in the model to set table content and triggers etc.
version table has to be in model
value in version table is computed from db_repo
things like triggers on one place along with table defs
initial table data in the model
upgrade db
prereq
version table already in db
% manage_db upgrade
developer's switch
recreate db from dump
transform your local changes to db upgrade scripts
testing
unittests
DBTest class can create fresh database automagically
acceptence/application tests
create fresh db from model
load in necessary data for the test
prereq
sa-migrete installed
add deps
setup
% migrate manage manage.py --repository=db_repo --url=sqlite:///project.db
update manage.py to use connection URI from config
rename manage.py to manage_db
update pkgdb 0.5.x -> 0.6.x
as in every other merge, the db upgrades
has to be merged manualy.
See merge guidelines for details