Asterisk - The Open Source Telephony Project  18.5.0
Functions | Variables
20abce6d1e3c_add_pjsip_identify_by_ip Namespace Reference

Functions

def downgrade ()
 
def enum_update (table_name, column_name, enum_name, enum_values)
 
def upgrade ()
 

Variables

string down_revision = 'a1698e8bb9c5'
 
string revision = '20abce6d1e3c'
 

Function Documentation

◆ downgrade()

def 20abce6d1e3c_add_pjsip_identify_by_ip.downgrade ( )

Definition at line 44 of file 20abce6d1e3c_add_pjsip_identify_by_ip.py.

References enum_update().

44 def downgrade():
45  enum_update('ps_endpoints', 'identify_by', 'pjsip_identify_by_values',
46  ['username', 'auth_username'])

◆ enum_update()

def 20abce6d1e3c_add_pjsip_identify_by_ip.enum_update (   table_name,
  column_name,
  enum_name,
  enum_values 
)

Definition at line 17 of file 20abce6d1e3c_add_pjsip_identify_by_ip.py.

Referenced by downgrade(), and upgrade().

17 def enum_update(table_name, column_name, enum_name, enum_values):
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', 'ps_endpoints')
21  op.alter_column(table_name, column_name,
22  type_=sa.Enum(*enum_values, name=enum_name))
23  return
24 
25  # Postgres requires a few more steps
26  tmp = enum_name + '_tmp'
27 
28  op.execute('ALTER TYPE ' + enum_name + ' RENAME TO ' + tmp)
29 
30  updated = sa.Enum(*enum_values, name=enum_name)
31  updated.create(op.get_bind(), checkfirst=False)
32 
33  op.execute('ALTER TABLE ' + table_name + ' ALTER COLUMN ' + column_name +
34  ' TYPE ' + enum_name + ' USING identify_by::text::' + enum_name)
35 
36  op.execute('DROP TYPE ' + tmp)
37 
38 
def enum_update(table_name, column_name, enum_name, enum_values)

◆ upgrade()

def 20abce6d1e3c_add_pjsip_identify_by_ip.upgrade ( )

Definition at line 39 of file 20abce6d1e3c_add_pjsip_identify_by_ip.py.

References enum_update().

39 def upgrade():
40  enum_update('ps_endpoints', 'identify_by', 'pjsip_identify_by_values',
41  ['username', 'auth_username', 'ip'])
42 
43 
def enum_update(table_name, column_name, enum_name, enum_values)

Variable Documentation

◆ down_revision

string down_revision = 'a1698e8bb9c5'

Definition at line 11 of file 20abce6d1e3c_add_pjsip_identify_by_ip.py.

◆ revision

string revision = '20abce6d1e3c'

Definition at line 10 of file 20abce6d1e3c_add_pjsip_identify_by_ip.py.