Asterisk - The Open Source Telephony Project GIT-master-f36a736
23530d604b96_add_rpid_immediate.py
Go to the documentation of this file.
2# Asterisk -- An open source telephony toolkit.
3#
4# Copyright (C) 2015, Richard Mudgett
5#
6# Richard Mudgett <rmudgett@digium.com>
7#
8# See http://www.asterisk.org for more information about
9# the Asterisk project. Please do not directly contact
10# any of the maintainers of this project for assistance;
11# the project provides a web site, mailing lists and IRC
12# channels for your use.
13#
14# This program is free software, distributed under the terms of
15# the GNU General Public License Version 2. See the LICENSE file
16# at the top of the source tree.
17#
18
19"""add rpid_immediate
20
21Revision ID: 23530d604b96
22Revises: 45e3f47c6c44
23Create Date: 2015-03-18 17:41:58.055412
24
25"""
26
27# revision identifiers, used by Alembic.
28revision = '23530d604b96'
29down_revision = '45e3f47c6c44'
30
31from alembic import op
32import sqlalchemy as sa
33from sqlalchemy.dialects.postgresql import ENUM
34
35YESNO_NAME = 'yesno_values'
36YESNO_VALUES = ['yes', 'no']
37
38def upgrade():
39 ############################# Enums ##############################
40
41 # yesno_values have already been created, so use postgres enum object
42 # type to get around "already created" issue - works okay with mysql
43 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
44
45 op.add_column('ps_endpoints', sa.Column('rpid_immediate', yesno_values))
46
48 if op.get_context().bind.dialect.name == 'mssql':
49 op.drop_constraint('ck_ps_endpoints_rpid_immediate_yesno_values','ps_endpoints')
50 op.drop_column('ps_endpoints', 'rpid_immediate')