Describe the bug
When using the inline_references parameter from #1780 to create a foreign key, the foreign key's ondelete parameter isn't respected.
Expected behavior
The following code
op.add_column(
"foo",
sa.Column(
"bar_id",
sa.UUID(),
sa.ForeignKey("bar.id", ondelete="SET NULL"),
nullable=True,
),
inline_references=True,
)
emits
ALTER TABLE foo ADD COLUMN bar_id UUID REFERENCES bar (id);
instead of
ALTER TABLE foo ADD COLUMN bar_id UUID REFERENCES bar (id) ON DELETE SET NULL;
To Reproduce
op.add_column(
"foo",
sa.Column(
"bar_id",
sa.UUID(),
sa.ForeignKey("bar.id", ondelete="SET NULL"),
nullable=True,
),
inline_references=True,
)
Versions.
- OS: Debian GNU/Linux 13
- Python: 3.13.9
- Alembic: 1.18.4
- SQLAlchemy: 2.0.49
- Database: PostgreSQL 16
- DBAPI:
Describe the bug
When using the
inline_referencesparameter from #1780 to create a foreign key, the foreign key'sondeleteparameter isn't respected.Expected behavior
The following code
emits
instead of
To Reproduce
Versions.