Skip to content

Commit

Permalink
- [bug] Fixed the generation of CHECK constraint,
Browse files Browse the repository at this point in the history
  regression from 0.2.0 [#26]
  • Loading branch information
zzzeek committed Jan 31, 2012
1 parent 0bf3fe8 commit e1fde10
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion alembic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from os import path

__version__ = '0.2.0'
__version__ = '0.2.1'

package_dir = path.abspath(path.dirname(__file__))

Expand Down
2 changes: 1 addition & 1 deletion alembic/autogenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
4 changes: 3 additions & 1 deletion tests/test_autogenerate.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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')
)
Expand Down

0 comments on commit e1fde10

Please sign in to comment.