diff options
author | Joshua Colp <jcolp@digium.com> | 2017-04-25 12:52:48 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2017-04-25 19:36:13 +0000 |
commit | c09b9dba9029efe00bc7528a8cd7e15bb037efab (patch) | |
tree | d6689beb18cbedd9393a6d313cd824ca5d2d27cd /contrib | |
parent | dac4442cdd787b58035fcd13d51abbf50a4d7cb3 (diff) |
alembic: Add table for 'resource_list' PJSIP RLS type.
This change adds an Alembic migration which adds a
ps_resource_list table that can contain resource_list
RLS configuration objects.
ASTERISK-26929
Change-Id: I7c888fafc67b3e87012de974f71ca7a5b8b1ec05
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/ast-db-manage/config/versions/1d0e332c32af_create_rls_table.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/ast-db-manage/config/versions/1d0e332c32af_create_rls_table.py b/contrib/ast-db-manage/config/versions/1d0e332c32af_create_rls_table.py new file mode 100644 index 000000000..3557f0d52 --- /dev/null +++ b/contrib/ast-db-manage/config/versions/1d0e332c32af_create_rls_table.py @@ -0,0 +1,39 @@ +"""create rls table + +Revision ID: 1d0e332c32af +Revises: 2da192dbbc65 +Create Date: 2017-04-25 12:50:09.412662 + +""" + +# revision identifiers, used by Alembic. +revision = '1d0e332c32af' +down_revision = '2da192dbbc65' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.postgresql import ENUM + +YESNO_NAME = 'yesno_values' +YESNO_VALUES = ['yes', 'no'] + +def upgrade(): + ############################# Enums ############################## + + # yesno_values have already been created, so use postgres enum object + # type to get around "already created" issue - works okay with mysql + yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False) + + op.create_table( + 'ps_resource_list', + sa.Column('id', sa.String(40), nullable=False, unique=True), + sa.Column('list_item', sa.String(2048)), + sa.Column('event', sa.String(40)), + sa.Column('full_state', yesno_values), + sa.Column('notification_batch_interval', sa.Integer), + ) + + op.create_index('ps_resource_list_id', 'ps_resource_list', ['id']) + +def downgrade(): + op.drop_table('ps_resource_list') |