]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix alembic script to work properly in offline mode.
authorMark Michelson <mmichelson@digium.com>
Thu, 6 Feb 2014 16:53:24 +0000 (16:53 +0000)
committerMark Michelson <mmichelson@digium.com>
Thu, 6 Feb 2014 16:53:24 +0000 (16:53 +0000)
When run in offline mode, this would attempt to check the database for
the presence of a type it was going to try to create. I now check the
context to see if we're running in offline mode and change a parameter
accordingly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@407567 65c4cc65-6c06-0410-ace0-fbb531ad65f3

contrib/ast-db-manage/config/versions/2fc7930b41b3_add_pjsip_endpoint_options_for_12_1.py

index 3119563f76a860261dc286b5e0416dcc2160f130..77d335493c24ae3ba20c6ed681c70347565abf32 100755 (executable)
@@ -11,6 +11,7 @@ revision = '2fc7930b41b3'
 down_revision = '581a4264e537'
 
 from alembic import op
+from alembic import context
 import sqlalchemy as sa
 
 YESNO_NAME = 'yesno_values'
@@ -45,7 +46,8 @@ def upgrade():
     # first it will think it already exists and fail
     pjsip_redirect_method_values = sa.Enum(
         *PJSIP_REDIRECT_METHOD_VALUES, name=PJSIP_REDIRECT_METHOD_NAME)
-    pjsip_redirect_method_values.create(op.get_bind(), checkfirst=True)
+    check = False if context.is_offline_mode() else True
+    pjsip_redirect_method_values.create(op.get_bind(), checkfirst=check)
 
     pjsip_transport_method_values = sa.Enum(
         *PJSIP_TRANSPORT_METHOD_VALUES, name=PJSIP_TRANSPORT_METHOD_NAME)