Add a migration to remove the image fields that were migrated to image storage, and add some uniqueness constraints to some indexes.
This commit is contained in:
parent
f405d575a3
commit
6d07cf94d2
1 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
"""Remove fields from image table that were migrated to imagestorage.
|
||||
|
||||
Revision ID: 201d55b38649
|
||||
Revises: 5a07499ce53f
|
||||
Create Date: 2014-06-12 19:48:53.861115
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '201d55b38649'
|
||||
down_revision = '5a07499ce53f'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('buildtriggerservice_name', table_name='buildtriggerservice')
|
||||
op.create_index('buildtriggerservice_name', 'buildtriggerservice', ['name'], unique=True)
|
||||
op.drop_column('image', 'comment')
|
||||
op.drop_column('image', 'checksum')
|
||||
op.drop_column('image', 'image_size')
|
||||
op.drop_column('image', 'command')
|
||||
op.drop_column('image', 'created')
|
||||
op.drop_index('logentrykind_name', table_name='logentrykind')
|
||||
op.create_index('logentrykind_name', 'logentrykind', ['name'], unique=True)
|
||||
op.drop_index('notificationkind_name', table_name='notificationkind')
|
||||
op.create_index('notificationkind_name', 'notificationkind', ['name'], unique=True)
|
||||
op.drop_index('role_name', table_name='role')
|
||||
op.create_index('role_name', 'role', ['name'], unique=True)
|
||||
op.drop_index('visibility_name', table_name='visibility')
|
||||
op.create_index('visibility_name', 'visibility', ['name'], unique=True)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index('visibility_name', table_name='visibility')
|
||||
op.create_index('visibility_name', 'visibility', ['name'], unique=False)
|
||||
op.drop_index('role_name', table_name='role')
|
||||
op.create_index('role_name', 'role', ['name'], unique=False)
|
||||
op.drop_index('notificationkind_name', table_name='notificationkind')
|
||||
op.create_index('notificationkind_name', 'notificationkind', ['name'], unique=False)
|
||||
op.drop_index('logentrykind_name', table_name='logentrykind')
|
||||
op.create_index('logentrykind_name', 'logentrykind', ['name'], unique=False)
|
||||
op.add_column('image', sa.Column('created', mysql.DATETIME(), nullable=True))
|
||||
op.add_column('image', sa.Column('command', mysql.LONGTEXT(), nullable=True))
|
||||
op.add_column('image', sa.Column('image_size', mysql.BIGINT(display_width=20), nullable=True))
|
||||
op.add_column('image', sa.Column('checksum', mysql.VARCHAR(length=255), nullable=True))
|
||||
op.add_column('image', sa.Column('comment', mysql.LONGTEXT(), nullable=True))
|
||||
op.drop_index('buildtriggerservice_name', table_name='buildtriggerservice')
|
||||
op.create_index('buildtriggerservice_name', 'buildtriggerservice', ['name'], unique=False)
|
||||
### end Alembic commands ###
|
Reference in a new issue