Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
31cd4f4891ec_add_auto_dtmf_mode Namespace Reference

Functions

def downgrade ()
 
def upgrade ()
 

Variables

string down_revision = '23530d604b96'
 
list NEW_ENUM = ['rfc4733', 'inband', 'info', 'auto']
 
 new_type = sa.Enum(*NEW_ENUM, name='pjsip_dtmf_mode_values_v2')
 
list OLD_ENUM = ['rfc4733', 'inband', 'info']
 
 old_type = sa.Enum(*OLD_ENUM, name='pjsip_dtmf_mode_values')
 
string revision = '31cd4f4891ec'
 

Function Documentation

◆ downgrade()

def 31cd4f4891ec_add_auto_dtmf_mode.downgrade ( )

Definition at line 42 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

42 def downgrade():
43  context = op.get_context()
44 
45  if context.bind.dialect.name != 'postgresql':
46  op.alter_column('ps_endpoints', 'dtmf_mode',
47  type_=old_type,
48  existing_type=new_type)
49  else:
50  enum = ENUM('rfc4733', 'inband', 'info',
51  name='pjsip_dtmf_mode_values')
52  enum.create(op.get_bind(), checkfirst=False)
53 
54  op.execute('ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE'
55  ' pjsip_dtmf_mode_values USING'
56  ' dtmf_mode::text::pjsip_dtmf_mode_values')
57 
58  ENUM(name="pjsip_dtmf_mode_values_v2").drop(op.get_bind(), checkfirst=False)

◆ upgrade()

def 31cd4f4891ec_add_auto_dtmf_mode.upgrade ( )

Definition at line 23 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

23 def upgrade():
24  context = op.get_context()
25 
26  # Upgrading to this revision WILL clear your directmedia values.
27  if context.bind.dialect.name != 'postgresql':
28  op.alter_column('ps_endpoints', 'dtmf_mode',
29  type_=new_type,
30  existing_type=old_type)
31  else:
32  enum = ENUM('rfc4733', 'inband', 'info', 'auto',
33  name='pjsip_dtmf_mode_values_v2')
34  enum.create(op.get_bind(), checkfirst=False)
35 
36  op.execute('ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE'
37  ' pjsip_dtmf_mode_values_v2 USING'
38  ' dtmf_mode::text::pjsip_dtmf_mode_values_v2')
39 
40  ENUM(name="pjsip_dtmf_mode_values").drop(op.get_bind(), checkfirst=False)
41 

Variable Documentation

◆ down_revision

string down_revision = '23530d604b96'

Definition at line 11 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

◆ NEW_ENUM

list NEW_ENUM = ['rfc4733', 'inband', 'info', 'auto']

Definition at line 18 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

◆ new_type

new_type = sa.Enum(*NEW_ENUM, name='pjsip_dtmf_mode_values_v2')

Definition at line 21 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

◆ OLD_ENUM

list OLD_ENUM = ['rfc4733', 'inband', 'info']

Definition at line 17 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

◆ old_type

old_type = sa.Enum(*OLD_ENUM, name='pjsip_dtmf_mode_values')

Definition at line 20 of file 31cd4f4891ec_add_auto_dtmf_mode.py.

◆ revision

string revision = '31cd4f4891ec'

Definition at line 10 of file 31cd4f4891ec_add_auto_dtmf_mode.py.