Asterisk - The Open Source Telephony Project GIT-master-115d7c0
1d0e332c32af_create_rls_table.py
Go to the documentation of this file.
1"""create rls table
2
3Revision ID: 1d0e332c32af
4Revises: 2da192dbbc65
5Create Date: 2017-04-25 12:50:09.412662
6
7"""
8
9# revision identifiers, used by Alembic.
10revision = '1d0e332c32af'
11down_revision = '2da192dbbc65'
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
20def upgrade():
21 ############################# Enums ##############################
22
23 # yesno_values have already been created, so use postgres enum object
24 # type to get around "already created" issue - works okay with mysql
25 yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
26
27 op.create_table(
28 'ps_resource_list',
29 sa.Column('id', sa.String(40), nullable=False, unique=True),
30 sa.Column('list_item', sa.String(2048)),
31 sa.Column('event', sa.String(40)),
32 sa.Column('full_state', yesno_values),
33 sa.Column('notification_batch_interval', sa.Integer),
34 )
35
36 op.create_index('ps_resource_list_id', 'ps_resource_list', ['id'])
37
39 op.drop_table('ps_resource_list')