Migrated issue, originally created by Marek Baczyński (@imbaczek)
DB: SQL Server 2008R2
SQLAlchemy==0.9.3
alembic==0.6.4dev
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('table', sa.Column('col3', sa.Boolean(name='ck_col3'), nullable=True))
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('table', 'col3', mssql_drop_check=True)
### end Alembic commands ###
when downgrading, alembic emits the following SQL
declare @const_name varchar(256)
select @const_name = [name] from sys.check_constraints
where parent_object_id = object_id('table')
and col_name(parent_object_id, parent_column_id) = 'col3'
-- expected
exec('alter table [table] drop constraint [' + @const_name + ']')
-- actually emitted
exec('alter table table drop constraint ' + @const_name)