PR: Move to Alembic for database migrations (v3)
Søren Løvborg
sorenl at unity3d.com
Mon Jul 18 17:26:35 UTC 2016
I've posted a new version of my Alembic work here:
https://kallithea-scm.org/repos/kallithea/pull-request/52
I'm still working on a migration to clean up the old cruft that have
accumulated in Kallithea databases over the years; this is
unfortunately a quite complex task, what with three database engines
to support, and an altogether unruly database model. :-)
But if this code is accepted, we could begin to take simpler changes
to the database, like added columns and such.
>From the PR description
-----------------------
This PR:
- corrects a few quirks in our current database model, as a
prerequisite for the following work
- removes remaining RhodeCode compatibility
- removes SQLAlchemy Migrate database migration library
- adds basic Alembic database migration support
- adds well-defined key/index/constraint naming (for new databases only...)
- documents how to use Alembic
It also (in the last two commits) demonstrates the use of Alembic for
a semi-complex database migration; these two commits are not actually
intended to be merged. Feel free to comment on the Alembic usage, but
don't waste your time on the actual demo feature, which is unfinished
and will be PR'ed separately when/if it is ready. :-)
Unlike the previous iterations, this PR has actually been tested on
MySQL and PostgreSQL, uncovering a number of surprising little
problems (fixed, among other places, in the first three commits).
Remaining work:
- Use Alembic to clean up old cruft in the database.
Please review the individual changesets, and feel free to comment here
on the mailing list.
For reviewing the documentation changes, I've also put a doc build up here:
https://files.unity3d.com/sorenl/f468d970f906/
In particular, you may want to read the new "Upgrading Kallithea":
https://files.unity3d.com/sorenl/f468d970f906/upgrade.html
And the new "Database schema changes":
https://files.unity3d.com/sorenl/f468d970f906/dev/dbmigrations.html
Best,
Søren
More information about the kallithea-general
mailing list