Skip to content

Conversation

@jrmalin
Copy link
Contributor

@jrmalin jrmalin commented Dec 10, 2025

Description

This adds an opt-in compare_check_constraints configuration option for autogenerate, allowing Alembic to detect check constraint differences between SQLAlchemy models and the database.

Changes:

  • New config option compare_check_constraints
  • Check constraint comparison logic
  • Check constraint signature class
  • Renderer for CreateCheckConstraintOp
  • Comparison method
  • Type stub
  • Tests covering add, remove, match, disabled, unnamed, invalid names, enum filtering, and bound parameters

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

jrmalin and others added 5 commits December 10, 2025 21:37
- Fix render.py:453 - handle string conditions before trying to compile
- Fix compare.py type annotations for sorted() calls
- Add "check_constraint" to Literal types in context.pyi

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix render.py:453 - handle string conditions before trying to compile
- Fix compare.py type annotations for sorted() calls
- Add "check_constraint" to Literal types in context.pyi

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
# Conflicts:
#	alembic/autogenerate/compare.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant