Mike Bayer avatar Mike Bayer committed f6e396c Merge

- forgot to push the tag

Comments (0)

Files changed (4)

+0.2.1
+=====
+- [bug] Fixed the generation of CHECK constraint,
+  regression from 0.2.0 [#26]
+
 0.2.0
 =====
 - [feature] API rearrangement allows everything

alembic/__init__.py

 from os import path
 
-__version__ = '0.2.0'
+__version__ = '0.2.1'
 
 package_dir = path.abspath(path.dirname(__file__))
 

alembic/autogenerate.py

         ),
     }
 
-def _render_check_constraint(constraint):
+def _render_check_constraint(constraint, autogen_context):
     opts = []
     if constraint.name:
         opts.append(("name", repr(constraint.name)))

tests/test_autogenerate.py

 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
         Column('id', Integer, primary_key=True),
         Column('description', String(100)),
         Column('order_id', Integer, ForeignKey('order.order_id')),
+        CheckConstraint('len(description) > 5')
     )
     return m
 
     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')
     )
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.