]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
revert primary_key=True change and replace with inline_primary_key
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Feb 2026 13:50:31 +0000 (08:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Feb 2026 14:58:34 +0000 (09:58 -0500)
commitfa35ee9264cb0cbe25729c753595f7a6ebbd3f70
tree030dc3e769064e163fdce520586847bfaf5a1f32
parent588bdacfac736cea7d51a0e21a3ba56c8e592fc9
revert primary_key=True change and replace with inline_primary_key

Reverted the behavior of :meth:`.Operations.add_column` that would
automatically render the "PRIMARY KEY" keyword inline when a
:class:`.Column` with ``primary_key=True`` is added. The automatic
behavior, added in version 1.18.2, is now opt-in via the new
:paramref:`.Operations.add_column.inline_primary_key` parameter. This
change restores the ability to render a PostgreSQL SERIAL column, which is
required to be ``primary_key=True``, while not impacting the ability to
render a separate primary key constraint. This also provides consistency
with the :paramref:`.Operations.add_column.inline_references` parameter and
gives users explicit control over SQL generation.

Fixes: #1232
Change-Id: Ia9333c1768caa5d99b0527d59fcc797af2c3249c
alembic/ddl/base.py
alembic/ddl/impl.py
alembic/op.pyi
alembic/operations/base.py
alembic/operations/ops.py
alembic/operations/toimpl.py
docs/build/changelog.rst
docs/build/unreleased/1232_amendment.rst [new file with mode: 0644]
tests/test_batch.py
tests/test_op.py
tests/test_postgresql.py