Asterisk - The Open Source Telephony Project  18.5.0
1d0e332c32af_create_rls_table.py
Go to the documentation of this file.
1 """create rls table
2 
3 Revision ID: 1d0e332c32af
4 Revises: 2da192dbbc65
5 Create Date: 2017-04-25 12:50:09.412662
6 
7 """
8 
9 # revision identifiers, used by Alembic.
10 revision = '1d0e332c32af'
11 down_revision = '2da192dbbc65'
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  ############################# 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 
38 def downgrade():
39  op.drop_table('ps_resource_list')