Asterisk - The Open Source Telephony Project  18.5.0
3bcc0b5bc2c9_add_allow_reload_to_ps_transports.py
Go to the documentation of this file.
1 """Add allow_reload to ps_transports
2 
3 Revision ID: 3bcc0b5bc2c9
4 Revises: dbc44d5a908
5 Create Date: 2016-02-05 17:43:39.183785
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = '3bcc0b5bc2c9'
11 down_revision = 'dbc44d5a908'
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_transports', sa.Column('allow_reload', yesno_values))
23 
24 def downgrade():
25  if op.get_context().bind.dialect.name == 'mssql':
26  op.drop_constraint('ck_ps_transports_allow_reload_yesno_values','ps_transports')
27  op.drop_column('ps_transports', 'allow_reload')