Fix migration

This commit is contained in:
Quentin Machu 2015-10-14 11:34:02 -04:00 committed by Jimmy Zelinskie
parent f59e35cc81
commit a99b8fcfe4

View file

@ -14,14 +14,15 @@ import sqlalchemy as sa
def upgrade(tables):
### commands auto generated by Alembic - please adjust! ###
op.add_column('image', sa.Column('parent_id', sa.Integer(), nullable=True))
op.add_column('image', sa.Column('security_indexed', sa.Boolean(), nullable=False))
op.add_column('image', sa.Column('security_indexed_engine', sa.Integer(), nullable=False))
op.add_column('image', sa.Column('security_indexed', sa.Boolean(), nullable=False, default=False, server_default=sa.sql.expression.false()))
op.add_column('image', sa.Column('security_indexed_engine', sa.Integer(), nullable=False, default=-1, server_default="-1"))
op.create_index('image_parent_id', 'image', ['parent_id'], unique=False)
op.create_foreign_key(op.f('fk_image_parent_id_image'), 'image', 'image', ['parent_id'], ['id'])
### end Alembic commands ###
op.create_index('image_security_indexed_engine_security_indexed', 'image', ['security_indexed_engine', 'security_indexed'])
def downgrade(tables):
op.drop_index('image_security_indexed_engine_security_indexed', 'image')
### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(op.f('fk_image_parent_id_image'), 'image', type_='foreignkey')
op.drop_index('image_parent_id', table_name='image')
@ -29,4 +30,3 @@ def downgrade(tables):
op.drop_column('image', 'security_indexed_engine')
op.drop_column('image', 'parent_id')
### end Alembic commands ###
op.drop_index('image_security_indexed', 'image')