summaryrefslogtreecommitdiff
path: root/contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py')
-rw-r--r--contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py b/contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py
index 0d84390b2..b1a9f8be8 100644
--- a/contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py
+++ b/contrib/ast-db-manage/config/versions/31cd4f4891ec_add_auto_dtmf_mode.py
@@ -20,14 +20,14 @@ NEW_ENUM = ['rfc4733', 'inband', 'info', 'auto']
old_type = sa.Enum(*OLD_ENUM, name='pjsip_dtmf_mode_values')
new_type = sa.Enum(*NEW_ENUM, name='pjsip_dtmf_mode_values_v2')
-tcr = sa.sql.table('ps_endpoints', sa.Column('dtmf_mode', new_type,
- nullable=True))
-
def upgrade():
context = op.get_context()
# Upgrading to this revision WILL clear your directmedia values.
- if context.bind.dialect.name != 'postgresql':
+ if context.bind.dialect.name == 'sqlite':
+ with op.batch_alter_table('ps_endpoints') as batch_op:
+ batch_op.alter_column('dtmf_mode', type_=new_type)
+ elif context.bind.dialect.name != 'postgresql':
op.alter_column('ps_endpoints', 'dtmf_mode',
type_=new_type,
existing_type=old_type)
@@ -45,10 +45,10 @@ def upgrade():
def downgrade():
context = op.get_context()
- op.execute(tcr.update().where(tcr.c.directmedia==u'outgoing')
- .values(directmedia=None))
-
- if context.bind.dialect.name != 'postgresql':
+ if context.bind.dialect.name == 'sqlite':
+ with op.batch_alter_table('ps_endpoints') as batch_op:
+ batch_op.alter_column('dtmf_mode', type_=old_type)
+ elif context.bind.dialect.name != 'postgresql':
op.alter_column('ps_endpoints', 'dtmf_mode',
type_=old_type,
existing_type=new_type)