diff --git a/CHANGES b/CHANGES index 273667a6..eaea5ca6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +0.2.1 +===== +- [bug] Fixed the generation of CHECK constraint, + regression from 0.2.0 [#26] + 0.2.0 ===== - [feature] API rearrangement allows everything diff --git a/alembic/__init__.py b/alembic/__init__.py index dd0591ec..500a414d 100644 --- a/alembic/__init__.py +++ b/alembic/__init__.py @@ -1,6 +1,6 @@ from os import path -__version__ = '0.2.0' +__version__ = '0.2.1' package_dir = path.abspath(path.dirname(__file__)) diff --git a/alembic/autogenerate.py b/alembic/autogenerate.py index d90114a3..8fc51920 100644 --- a/alembic/autogenerate.py +++ b/alembic/autogenerate.py @@ -454,7 +454,7 @@ def _render_foreign_key(constraint, autogen_context): ), } -def _render_check_constraint(constraint): +def _render_check_constraint(constraint, autogen_context): opts = [] if constraint.name: opts.append(("name", repr(constraint.name))) diff --git a/tests/test_autogenerate.py b/tests/test_autogenerate.py index 264dc06c..497ceb21 100644 --- a/tests/test_autogenerate.py +++ b/tests/test_autogenerate.py @@ -1,5 +1,5 @@ from sqlalchemy import MetaData, Column, Table, Integer, String, Text, \ - Numeric, CHAR, ForeignKey, DATETIME, TypeDecorator + Numeric, CHAR, ForeignKey, DATETIME, TypeDecorator, CheckConstraint from sqlalchemy.types import NULLTYPE from sqlalchemy.engine.reflection import Inspector from alembic import autogenerate @@ -65,6 +65,7 @@ def _model_two(): Column('id', Integer, primary_key=True), Column('description', String(100)), Column('order_id', Integer, ForeignKey('order.order_id')), + CheckConstraint('len(description) > 5') ) return m @@ -182,6 +183,7 @@ def test_render_diffs(self): sa.Column('id', sa.Integer(), nullable=False), sa.Column('description', sa.String(length=100), nullable=True), sa.Column('order_id', sa.Integer(), nullable=True), + sa.CheckConstraint('TODO'), sa.ForeignKeyConstraint(['order_id'], ['order.order_id'], ), sa.PrimaryKeyConstraint('id') )