1 """Add auto_info to endpoint dtmf_mode 3 Revision ID: 164abbd708c 5 Create Date: 2017-06-19 13:55:15.354706 10 revision =
'164abbd708c' 11 down_revision =
'39959b9c2566' 13 from alembic
import op
14 import sqlalchemy
as sa
15 from sqlalchemy.dialects.postgresql
import ENUM
17 OLD_ENUM = [
'rfc4733',
'inband',
'info',
'auto']
18 NEW_ENUM = [
'rfc4733',
'inband',
'info',
'auto',
'auto_info']
20 old_type = sa.Enum(*OLD_ENUM, name=
'pjsip_dtmf_mode_values_v2')
21 new_type = sa.Enum(*NEW_ENUM, name=
'pjsip_dtmf_mode_values_v3')
24 context = op.get_context()
27 if context.bind.dialect.name !=
'postgresql':
28 op.alter_column(
'ps_endpoints',
'dtmf_mode',
30 existing_type=old_type)
32 enum = ENUM(
'rfc4733',
'inband',
'info',
'auto',
'auto_info',
33 name=
'pjsip_dtmf_mode_values_v3')
34 enum.create(op.get_bind(), checkfirst=
False)
36 op.execute(
'ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE' 37 ' pjsip_dtmf_mode_values_v3 USING' 38 ' dtmf_mode::text::pjsip_dtmf_mode_values_v3')
40 ENUM(name=
"pjsip_dtmf_mode_values_v2").drop(op.get_bind(), checkfirst=
False)
43 context = op.get_context()
45 if context.bind.dialect.name !=
'postgresql':
46 op.alter_column(
'ps_endpoints',
'dtmf_mode',
48 existing_type=new_type)
50 enum = ENUM(
'rfc4733',
'inband',
'info',
'auto',
51 name=
'pjsip_dtmf_mode_values_v2')
52 enum.create(op.get_bind(), checkfirst=
False)
54 op.execute(
'ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE' 55 ' pjsip_dtmf_mode_values_v2 USING' 56 ' dtmf_mode::text::pjsip_dtmf_mode_values_v2')
58 ENUM(name=
"pjsip_dtmf_mode_values_v3").drop(op.get_bind(), checkfirst=
False)