Asterisk - The Open Source Telephony Project  18.5.0
19b00bc19b7b_add_suppress_q850_reason_headers_to_.py
Go to the documentation of this file.
1 """add suppress_q850_reason_headers to endpoint
2 
3 Revision ID: 19b00bc19b7b
4 Revises: 0be05c3a8225
5 Create Date: 2018-07-06 06:30:32.196669
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = '19b00bc19b7b'
11 down_revision = '0be05c3a8225'
12 
13 from alembic import op
14 import sqlalchemy as sa
15 from sqlalchemy.dialects.postgresql import ENUM
16 
17 YESNO_NAME = 'yesno_values'
18 YESNO_VALUES = ['yes', 'no']
19 
20 def upgrade():
21  yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
22  op.add_column('ps_endpoints', sa.Column('suppress_q850_reason_header', yesno_values))
23 
24 def downgrade():
25  if op.get_context().bind.dialect.name == 'mssql':
26  op.drop_constraint('ck_ps_endpoints_suppress_q850_reason_header_yesno_values','ps_endpoints')
27  op.drop_column('ps_endpoints', 'suppress_q850_reason_header')