bundle: migrations?
erichanson opened this issue · 0 comments
erichanson commented
Schema changes. How does bundle handle this?
The ideal thing is to put schema in version control, and have checkout intelligently and invisibly do migrations under the hood. BUT, right now bundle is pretty slow if we don't ignore all the meta views, and doing this right is fairly complex (though entirely possible), aka not at all in the spirit of trying to prove a concept.
SO, options:
- revisit doing version control on schema (and everything else in meta) by removing the ignore rules, as prototyped in the
extensions-to-bundles.sql
script - add a bundle.commit_migration table that contains raw sql to be run when a commit is checked out. A first commit would have the
CREATE TABLE
statements required, and then each additional commit MAY have a migration script that goes along with it. Checking out a bundle for the first time would run all the migrations in the commit ancestry, which should do the right thing. Checking out a commit when a different version has already been checked out would run all the migrations present (if any) since the previous commit. Checking out an OLDER commit than the one currently checked out would need to run thedown
migrations, which come to think of it should probably exist as well.