Skip to content
Snippets Groups Projects
Commit 8bdf374c authored by Richard Mudgett's avatar Richard Mudgett
Browse files

Fix alembic script to work properly in offline mode.

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.
........

Merged revisions 407567 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 5273a148
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ revision = '2fc7930b41b3'
down_revision = '581a4264e537'
from alembic import op
from alembic import context
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
......@@ -38,7 +39,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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment