From a6612e80aacd6f7b446940d48f2f1cbd24875a56 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Wed, 6 Aug 2014 17:04:08 +0000 Subject: alembic: Adjust sippeers, queue_members, and voicemail_messages tables. * Increased the sippeers useragent max string size to 255. * Changed the queue_members uniqueid to an auto incremented integer instead of a string. * Increased the voicemail_messages BLOB size to LONGBLOB on mysql. * Fixed the add_tables_for_pjsip config change version downgrade actions to drop a table it created. * Adjusted the sample alembic.ini files cdr.ini.sample, config.ini.sample, and voicemail.ini.sample to give a mysql and postgres sqlalchemy.url lines. ASTERISK-23847 #close Reported by: Stephen More ASTERISK-23825 #close Reported by: Stephen More ASTERISK-23909 #close Reported by: Stephen More Review: https://reviewboard.asterisk.org/r/3870/ ........ Merged revisions 420211 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@420212 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- .../1758e8bbf6b_increase_useragent_column_size.py | 41 +++++++++++++++ .../versions/43956d550a44_add_tables_for_pjsip.py | 1 + .../5139253c0423_make_q_member_uniqueid_autoinc.py | 60 ++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100755 contrib/ast-db-manage/config/versions/1758e8bbf6b_increase_useragent_column_size.py create mode 100755 contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py (limited to 'contrib/ast-db-manage/config/versions') diff --git a/contrib/ast-db-manage/config/versions/1758e8bbf6b_increase_useragent_column_size.py b/contrib/ast-db-manage/config/versions/1758e8bbf6b_increase_useragent_column_size.py new file mode 100755 index 000000000..215726fa0 --- /dev/null +++ b/contrib/ast-db-manage/config/versions/1758e8bbf6b_increase_useragent_column_size.py @@ -0,0 +1,41 @@ +# +# Asterisk -- An open source telephony toolkit. +# +# Copyright (C) 2014, Richard Mudgett +# +# Richard Mudgett +# +# See http://www.asterisk.org for more information about +# the Asterisk project. Please do not directly contact +# any of the maintainers of this project for assistance; +# the project provides a web site, mailing lists and IRC +# channels for your use. +# +# This program is free software, distributed under the terms of +# the GNU General Public License Version 2. See the LICENSE file +# at the top of the source tree. +# + +"""increase useragent column size + +Revision ID: 1758e8bbf6b +Revises: 1d50859ed02e +Create Date: 2014-07-28 14:04:17.874332 + +""" + +# revision identifiers, used by Alembic. +revision = '1758e8bbf6b' +down_revision = '1d50859ed02e' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.alter_column('sippeers', 'useragent', type_=sa.String(255)) + + +def downgrade(): + op.alter_column('sippeers', 'useragent', type_=sa.String(20)) + diff --git a/contrib/ast-db-manage/config/versions/43956d550a44_add_tables_for_pjsip.py b/contrib/ast-db-manage/config/versions/43956d550a44_add_tables_for_pjsip.py index 2fabf7af4..0c4d9c8f8 100755 --- a/contrib/ast-db-manage/config/versions/43956d550a44_add_tables_for_pjsip.py +++ b/contrib/ast-db-manage/config/versions/43956d550a44_add_tables_for_pjsip.py @@ -184,5 +184,6 @@ def downgrade(): op.drop_table('ps_endpoints') op.drop_table('ps_auths') op.drop_table('ps_aors') + op.drop_table('ps_contacts') op.drop_table('ps_domain_aliases') op.drop_table('ps_endpoint_id_ips') diff --git a/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py b/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py new file mode 100755 index 000000000..6bcaa9a10 --- /dev/null +++ b/contrib/ast-db-manage/config/versions/5139253c0423_make_q_member_uniqueid_autoinc.py @@ -0,0 +1,60 @@ +# +# Asterisk -- An open source telephony toolkit. +# +# Copyright (C) 2014, Richard Mudgett +# +# Richard Mudgett +# +# See http://www.asterisk.org for more information about +# the Asterisk project. Please do not directly contact +# any of the maintainers of this project for assistance; +# the project provides a web site, mailing lists and IRC +# channels for your use. +# +# This program is free software, distributed under the terms of +# the GNU General Public License Version 2. See the LICENSE file +# at the top of the source tree. +# + +"""make q member uniqueid autoinc + +Revision ID: 5139253c0423 +Revises: 1758e8bbf6b +Create Date: 2014-07-29 16:26:51.184981 + +""" + +# revision identifiers, used by Alembic. +revision = '5139253c0423' +down_revision = '1758e8bbf6b' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + # Was unable to find a way to use op.alter_column() to add the unique + # index property. + op.drop_column('queue_members', 'uniqueid') + op.add_column( + 'queue_members', + sa.Column( + name='uniqueid', type_=sa.Integer, nullable=False, + unique=True)) + # The postgres backend does not like the autoincrement needed for + # mysql here. It is just the backend that is giving a warning and + # not the database itself. + op.alter_column( + table_name='queue_members', column_name='uniqueid', + existing_type=sa.Integer, existing_nullable=False, + autoincrement=True) + + +def downgrade(): + # Was unable to find a way to use op.alter_column() to remove the + # unique index property. + op.drop_column('queue_members', 'uniqueid') + op.add_column( + 'queue_members', + sa.Column(name='uniqueid', type_=sa.String(80), nullable=False)) + -- cgit v1.2.3