Merge lp:~raoul-snyman/openlp/db-upgrades into lp:openlp
Status: | Merged |
---|---|
Approved by: | Andreas Preikschat |
Approved revision: | 1725 |
Merged at revision: | 1721 |
Proposed branch: | lp:~raoul-snyman/openlp/db-upgrades |
Merge into: | lp:openlp |
Diff against target: |
397 lines (+181/-37) 6 files modified
openlp/core/lib/db.py (+81/-5) openlp/plugins/songs/lib/db.py (+15/-26) openlp/plugins/songs/lib/upgrade.py (+77/-0) openlp/plugins/songs/songsplugin.py (+3/-2) resources/debian/debian/control (+1/-1) scripts/check_dependencies.py (+4/-3) |
To merge this branch: | bzr merge lp:~raoul-snyman/openlp/db-upgrades |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andreas Preikschat (community) | Approve | ||
Tim Bentley | Approve | ||
Review via email: mp+72953@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-25.
Commit message
- Implemented a seamless database upgrade system.
- Added the first upgrade as a demonstration.
- Added database version check so that newer version databases are not loaded.
Description of the change
Database upgrade system.
1. Create a module to use for upgrading.
2. from migrate import changeset
3. Define some default tables, which use reflection, in an "upgrade_setup()" function.
4. Write your upgrade functions named "upgrade_X()" where X is the version number.
5. Write your upgrade statements using the extended methods from Migrate.
6. Make sure the DB manager object knows about the upgrade module.
Done!
To test this:
1. Install SQLAlchemy Migrate (eg: apt-get install python-migrate)
2. Backup your songs database
3. Run OpenLP
4. Look for a "weight" column on the "media_files" table