Asterisk - The Open Source Telephony Project GIT-master-f36a736
Functions | Variables
52798ad97bdf_add_pjsip_identify_by_header Namespace Reference

Functions

def column_downgrade (table_name, column_name, enum_name, enum_values)
 
def column_upgrade (table_name, column_name, enum_name)
 
def downgrade ()
 
def upgrade ()
 

Variables

string down_revision = 'e2f04d309071'
 
string revision = '52798ad97bdf'
 

Function Documentation

◆ column_downgrade()

def column_downgrade (   table_name,
  column_name,
  enum_name,
  enum_values 
)

Definition at line 32 of file 52798ad97bdf_add_pjsip_identify_by_header.py.

32def column_downgrade(table_name, column_name, enum_name, enum_values):
33 if op.get_context().bind.dialect.name != 'postgresql':
34 op.alter_column(table_name, column_name,
35 type_=sa.Enum(*enum_values, name=enum_name))
36 return
37
38 # Postgres requires a few more steps
39 updated = sa.Enum(*enum_values, name=enum_name)
40 updated.create(op.get_bind(), checkfirst=False)
41
42 op.execute('ALTER TABLE ' + table_name + ' ALTER COLUMN ' + column_name +
43 ' TYPE ' + enum_name + ' USING identify_by::text::' + enum_name)
44
45
def column_downgrade(table_name, column_name, enum_name, enum_values)

Referenced by downgrade().

◆ column_upgrade()

def column_upgrade (   table_name,
  column_name,
  enum_name 
)

Definition at line 17 of file 52798ad97bdf_add_pjsip_identify_by_header.py.

17def column_upgrade(table_name, column_name, enum_name):
18 if op.get_context().bind.dialect.name != 'postgresql':
19 if op.get_context().bind.dialect.name == 'mssql':
20 op.drop_constraint('ck_ps_endpoints_identify_by_pjsip_identify_by_values',
21 table_name)
22 op.alter_column(table_name, column_name, type_=sa.String(80))
23 return
24
25 # Postgres requires a few more steps
26 op.execute('ALTER TABLE ' + table_name + ' ALTER COLUMN ' + column_name +
27 ' TYPE varchar(80) USING identify_by::text::' + enum_name)
28
29 op.execute('DROP TYPE ' + enum_name)
30
31

Referenced by upgrade().

◆ downgrade()

def downgrade ( )

Definition at line 55 of file 52798ad97bdf_add_pjsip_identify_by_header.py.

55def downgrade():
56 column_downgrade('ps_endpoints', 'identify_by', 'pjsip_identify_by_values',
57 ['username', 'auth_username', 'ip'])

References column_downgrade().

◆ upgrade()

def upgrade ( )

Definition at line 46 of file 52798ad97bdf_add_pjsip_identify_by_header.py.

46def upgrade():
47 # The ps_endpoints identify_by column has always been a comma separated
48 # list of enum values. This is better represented as a string anyway to
49 # avoid database compatibility issues. Also future changes are likely
50 # to allow loadable endpoint identifier names and negating fixed enum
51 # benefits.
52 column_upgrade('ps_endpoints', 'identify_by', 'pjsip_identify_by_values')
53
54

References column_upgrade().

Variable Documentation

◆ down_revision

string down_revision = 'e2f04d309071'

Definition at line 11 of file 52798ad97bdf_add_pjsip_identify_by_header.py.

◆ revision

string revision = '52798ad97bdf'

Definition at line 10 of file 52798ad97bdf_add_pjsip_identify_by_header.py.