Asterisk - The Open Source Telephony Project  18.5.0
c7a44a5a0851_pjsip_add_global_mwi_options.py
Go to the documentation of this file.
1 """pjsip: add global MWI options
2 
3 Revision ID: c7a44a5a0851
4 Revises: 4a6c67fa9b7a
5 Create Date: 2016-08-03 15:08:22.524727
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = 'c7a44a5a0851'
11 down_revision = '4a6c67fa9b7a'
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 
21 def upgrade():
22  ############################# Enums ##############################
23 
24  # yesno_values have already been created, so use postgres enum object
25  # type to get around "already created" issue - works okay with mysql
26  yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
27 
28  op.add_column('ps_globals', sa.Column('mwi_tps_queue_high', sa.Integer))
29  op.add_column('ps_globals', sa.Column('mwi_tps_queue_low', sa.Integer))
30  op.add_column('ps_globals', sa.Column('mwi_disable_initial_unsolicited', yesno_values))
31 
32 def downgrade():
33  op.drop_column('ps_globals', 'mwi_tps_queue_high')
34  op.drop_column('ps_globals', 'mwi_tps_queue_low')
35  if op.get_context().bind.dialect.name == 'mssql':
36  op.drop_constraint('ck_ps_globals_mwi_disable_initial_unsolicited_yesno_values','ps_globals')
37  op.drop_column('ps_globals', 'mwi_disable_initial_unsolicited')