]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
neutron-db-manage: sync HEADS file with 'current' output
authorIhar Hrachyshka <ihrachys@redhat.com>
Thu, 20 Aug 2015 09:50:09 +0000 (11:50 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Thu, 20 Aug 2015 09:54:12 +0000 (11:54 +0200)
commit905064eb61479fcd8fdf0e600aaea38ba505d3bb
tree9780d4001ec2800628c3ca3539a789ba09d7e5fd
parent194489b0f4885a2909333446a815896ea4d60320
neutron-db-manage: sync HEADS file with 'current' output

alembic.get_heads() returns all heads for all branches it can find in
scripts dir, while in alembic_version table, it does not store any heads
that were overridden by other branches, even if those depends_on it
instead of having it as down_revision.

To keep 'current' output in sync with what is in HEADS file, we can
attach liberty_* branches explicitly to kilo revision.

It's also a good idea to have a separate 'heads' command that would show
the latest alembic heads based on scripts dir state. See [1] for more
details.

While at it, since different subprojects can link their expand/contract
branches to kilo in different way (some using depends_on the previous
release branch, while others, as suggested in this patch, thru
down_revision to kilo), we kill the check on the number of heads
returned by script.get_heads() since it may differ. If we want to
validate that we don't branch more than twice from kilo, we may add a
separate validation just for that.

[1]: https://review.openstack.org/#/c/204551/

Change-Id: If551633ab26e0eac549c1e13cfa0771383a1a060
Partially-Implements: blueprint online-schema-migrations
neutron/db/migration/alembic_migrations/versions/HEADS
neutron/db/migration/alembic_migrations/versions/liberty/contract/30018084ec99_initial.py
neutron/db/migration/alembic_migrations/versions/liberty/expand/354db87e3225_nsxv_vdr_metadata.py
neutron/db/migration/cli.py
neutron/tests/unit/db/test_migration.py