diff --git a/doc/source/devref/alembic_migrations.rst b/doc/source/devref/alembic_migrations.rst index 78d17f62ea7..bcbdde665f2 100644 --- a/doc/source/devref/alembic_migrations.rst +++ b/doc/source/devref/alembic_migrations.rst @@ -417,6 +417,27 @@ following directive should be added in the contraction script:: depends_on = ('',) +Expand and Contract Branch Exceptions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In some cases, we have to have "expand" operations in contract migrations. For +example, table 'networksegments' was renamed in contract migration, so all +operations with this table are required to be in contract branch as well. +For such cases, we use the ``contract_creation_exceptions`` that should be +implemented as part of such migrations. This is needed to get functional tests +pass. + +Usage:: + + def contract_creation_exceptions(): + """Docstring should explain why we allow such exception for contract + branch. + """ + return { + sqlalchemy_obj_type: ['name'] + # For example: sa.Column: ['subnets.segment_id'] + } + Expand and Contract Branch Labeling ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~