Change8

rel_1_19_2

Breaking Changes
📦 alembicView on GitHub →
1 breaking1 features🐛 2 fixes🔧 4 symbols

Summary

This release renames and modifies the default behavior of the CHECK constraint autogenerate plugin and improves ForeignKey parsing for SQLAlchemy 2.1+.

⚠️ Breaking Changes

  • The autogenerate plugin for CHECK constraint detection by name is no longer enabled by default. It has been renamed from `alembic.autogenerate.checkconstraint_byname` to `alembic.ext.checkconstraint_byname` and no longer matches on the `"alembic.autogenerate.*"` wildcard. To maintain previous behavior, explicitly add `alembic.ext.checkconstraint_byname` to your plugins list in `env.py`.

Migration Steps

  1. If you were using the `alembic.autogenerate.checkconstraint_byname` plugin, rename it to `alembic.ext.checkconstraint_byname` in your `env.py` file.

✨ New Features

  • The target of a `~sqlalchemy.schema.ForeignKey` is now located using the `ForeignKey.target_tokens` and `ForeignKey.target_table_key` accessors (added in SQLAlchemy 2.1), which correctly handles foreign key targets containing dots in their names. This change improves parsing accuracy for batch migrations and autogenerate rendering.

🐛 Bug Fixes

  • Type bound CHECK constraints (generated for Boolean and Enum datatypes when `create_constraint` is True) are no longer ignored by the metadata side, allowing for normal name-based matching.
  • Autogenerate and batch migrations now correctly parse foreign key targets that contain dots in their names by using `ForeignKey.target_tokens` and `ForeignKey.target_table_key` when running against SQLAlchemy 2.1 or later.

Affected Symbols