5139253c0423_make_q_member_uniqueid_autoinc.py

Go to the documentation of this file.
00001 #
00002 # Asterisk -- An open source telephony toolkit.
00003 #
00004 # Copyright (C) 2014, Richard Mudgett
00005 #
00006 # Richard Mudgett <rmudgett@digium.com>
00007 #
00008 # See http://www.asterisk.org for more information about
00009 # the Asterisk project. Please do not directly contact
00010 # any of the maintainers of this project for assistance;
00011 # the project provides a web site, mailing lists and IRC
00012 # channels for your use.
00013 #
00014 # This program is free software, distributed under the terms of
00015 # the GNU General Public License Version 2. See the LICENSE file
00016 # at the top of the source tree.
00017 #
00018 
00019 """make q member uniqueid autoinc
00020 
00021 Revision ID: 5139253c0423
00022 Revises: 1758e8bbf6b
00023 Create Date: 2014-07-29 16:26:51.184981
00024 
00025 """
00026 
00027 # revision identifiers, used by Alembic.
00028 revision = '5139253c0423'
00029 down_revision = '1758e8bbf6b'
00030 
00031 from alembic import op
00032 import sqlalchemy as sa
00033 
00034 
00035 def upgrade():
00036     # Was unable to find a way to use op.alter_column() to add the unique
00037     # index property.
00038     op.drop_column('queue_members', 'uniqueid')
00039     op.add_column(
00040         'queue_members',
00041         sa.Column(
00042             name='uniqueid', type_=sa.Integer, nullable=False,
00043             unique=True))
00044     # The postgres backend does not like the autoincrement needed for
00045     # mysql here.  It is just the backend that is giving a warning and
00046     # not the database itself.
00047     op.alter_column(
00048         table_name='queue_members', column_name='uniqueid',
00049         existing_type=sa.Integer, existing_nullable=False,
00050         autoincrement=True)
00051 
00052 
00053 def downgrade():
00054     # Was unable to find a way to use op.alter_column() to remove the
00055     # unique index property.
00056     op.drop_column('queue_members', 'uniqueid')
00057     op.add_column(
00058         'queue_members',
00059         sa.Column(name='uniqueid', type_=sa.String(80), nullable=False))
00060 

Generated on Thu Apr 16 06:27:05 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6