From 860624153fa9c5a89806ad9078571148d1144926 Mon Sep 17 00:00:00 2001 From: Ann Kamyshnikova Date: Wed, 6 Jul 2016 14:33:12 +0300 Subject: [PATCH] Add information about contract creation exceptions in devref Change Ia0f39697afddec7cd04f870746a4bdd8b9410a32 introduce contract_creation_exceptions which should be implemented in migrations that add something in contract branch. Put some details of its usage in devref. Change-Id: I1a0b3d384ee8a967ce7f697886630b688843cdaa Related-bug: #1589328 --- doc/source/devref/alembic_migrations.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~