Asterisk - The Open Source Telephony Project GIT-master-115d7c0
c7a44a5a0851_pjsip_add_global_mwi_options.py
Go to the documentation of this file.
1"""pjsip: add global MWI options
2
3Revision ID: c7a44a5a0851
4Revises: 4a6c67fa9b7a
5Create Date: 2016-08-03 15:08:22.524727
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = 'c7a44a5a0851'
11down_revision = '4a6c67fa9b7a'
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
20
21def 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
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')