Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
4c573e7135bd_fix_tos_field_types Namespace Reference

Functions

def downgrade ()
 
def upgrade ()
 

Variables

string down_revision = '28887f25a46f'
 
string revision = '4c573e7135bd'
 
string YESNO_NAME = 'yesno_values'
 
list YESNO_VALUES = ['yes', 'no']
 

Function Documentation

◆ downgrade()

def 4c573e7135bd_fix_tos_field_types.downgrade ( )

Definition at line 34 of file 4c573e7135bd_fix_tos_field_types.py.

34 def downgrade():
35 
36  yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
37 
38  # Can't cast string to YESNO_VALUES, so dropping and adding is required
39  op.drop_column('ps_endpoints', 'tos_audio')
40  op.drop_column('ps_endpoints', 'tos_video')
41  op.add_column('ps_endpoints', sa.Column('tos_audio', yesno_values))
42  op.add_column('ps_endpoints', sa.Column('tos_video', yesno_values))
43  op.drop_column('ps_endpoints', 'cos_audio')
44  op.drop_column('ps_endpoints', 'cos_video')
45  op.add_column('ps_endpoints', sa.Column('cos_audio', yesno_values))
46  op.add_column('ps_endpoints', sa.Column('cos_video', yesno_values))
47 
48  if op.get_context().bind.dialect.name == 'mssql':
49  op.drop_constraint('ck_ps_transports_tos_yesno_values', 'ps_transports')
50  op.drop_column('ps_transports', 'tos')
51  op.add_column('ps_transports', sa.Column('tos', yesno_values))
52  # Can't cast integers to YESNO_VALUES, so dropping and adding is required
53  op.drop_column('ps_transports', 'cos')
54  op.add_column('ps_transports', sa.Column('cos', yesno_values))

◆ upgrade()

def 4c573e7135bd_fix_tos_field_types.upgrade ( )

Definition at line 20 of file 4c573e7135bd_fix_tos_field_types.py.

20 def upgrade():
21  op.alter_column('ps_endpoints', 'tos_audio', type_=sa.String(10))
22  op.alter_column('ps_endpoints', 'tos_video', type_=sa.String(10))
23  op.drop_column('ps_endpoints', 'cos_audio')
24  op.drop_column('ps_endpoints', 'cos_video')
25  op.add_column('ps_endpoints', sa.Column('cos_audio', sa.Integer))
26  op.add_column('ps_endpoints', sa.Column('cos_video', sa.Integer))
27 
28  op.alter_column('ps_transports', 'tos', type_=sa.String(10))
29 
30  # Can't cast YENO_VALUES to Integers, so dropping and adding is required
31  op.drop_column('ps_transports', 'cos', schema=None, mssql_drop_check=True)
32  op.add_column('ps_transports', sa.Column('cos', sa.Integer))
33 

Variable Documentation

◆ down_revision

string down_revision = '28887f25a46f'

Definition at line 11 of file 4c573e7135bd_fix_tos_field_types.py.

◆ revision

string revision = '4c573e7135bd'

Definition at line 10 of file 4c573e7135bd_fix_tos_field_types.py.

◆ YESNO_NAME

string YESNO_NAME = 'yesno_values'

Definition at line 17 of file 4c573e7135bd_fix_tos_field_types.py.

◆ YESNO_VALUES

list YESNO_VALUES = ['yes', 'no']

Definition at line 18 of file 4c573e7135bd_fix_tos_field_types.py.