1 """add pjsip identify by header 3 Revision ID: 52798ad97bdf 5 Create Date: 2018-01-08 12:16:02.782277 10 revision =
'52798ad97bdf' 11 down_revision =
'e2f04d309071' 13 from alembic
import op
14 import sqlalchemy
as sa
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',
22 op.alter_column(table_name, column_name, type_=sa.String(80))
26 op.execute(
'ALTER TABLE ' + table_name +
' ALTER COLUMN ' + column_name +
27 ' TYPE varchar(80) USING identify_by::text::' + enum_name)
29 op.execute(
'DROP TYPE ' + enum_name)
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))
39 updated = sa.Enum(*enum_values, name=enum_name)
40 updated.create(op.get_bind(), checkfirst=
False)
42 op.execute(
'ALTER TABLE ' + table_name +
' ALTER COLUMN ' + column_name +
43 ' TYPE ' + enum_name +
' USING identify_by::text::' + enum_name)
52 column_upgrade(
'ps_endpoints',
'identify_by',
'pjsip_identify_by_values')
57 [
'username',
'auth_username',
'ip'])