Asterisk - The Open Source Telephony Project GIT-master-f36a736
5950038a6ead_fix_pjsip_verifiy_typo.py
Go to the documentation of this file.
1"""Fix pjsip transports verify column
2
3Revision ID: 5950038a6ead
4Revises: d39508cb8d8
5Create Date: 2014-09-15 06:21:35.047314
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = '5950038a6ead'
11down_revision = 'd39508cb8d8'
12
13from alembic import op
14import sqlalchemy as sa
15from sqlalchemy.dialects.postgresql import ENUM
16
17YESNO_NAME = 'yesno_values'
18YESNO_VALUES = ['yes', 'no']
19
20def upgrade():
21 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
22
23 if op.get_context().bind.dialect.name != 'mssql':
24 op.alter_column('ps_transports', 'verifiy_server', type_=yesno_values,
25 new_column_name='verify_server')
26 else:
27 op.alter_column('ps_transports', 'verifiy_server', existing_type=yesno_values, type_=sa.String(3),
28 new_column_name='verify_server')
29 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=True)
30 op.alter_column('ps_transports', 'verify_server', existing_type=sa.String(3), type_=yesno_values)
31
32
34 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
35 if op.get_context().bind.dialect.name != 'mssql':
36 op.alter_column('ps_transports', 'verify_server', type_=yesno_values,
37 new_column_name='verifiy_server')
38 else:
39 op.alter_column('ps_transports', 'verify_server', existing_type=yesno_values, type_=sa.String(3),
40 new_column_name='verifiy_server')
41 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=True)
42 op.alter_column('ps_transports', 'verifiy_server', existing_type=sa.String(3), type_=yesno_values)