]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
Render `if_not_exists` option for CreateTableOp, CreateIndexOp, DropTableOp and...
authorLouis-Amaury Chaib <louisamaury.chaib@partoo.fr>
Mon, 23 Sep 2024 12:23:02 +0000 (08:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 23 Sep 2024 12:34:07 +0000 (08:34 -0400)
commit3db374f19760320507a96443e29d19835654b2ec
treeae574c094f64d167c3dada09d125a60f1ffc6111
parent8fae3e1d0813b35b1ffae22ef38f7bea7c93381f
Render `if_not_exists`  option for CreateTableOp, CreateIndexOp, DropTableOp and DropIndexOp

Render ``if_exists`` and ``if_not_exists`` parameters in
:class:`.CreateTableOp`, :class:`.CreateIndexOp`, :class:`.DropTableOp` and
:class:`.DropIndexOp` in an autogenerate context.  While Alembic does not
set these parameters during an autogenerate run, they can be enabled using
a custom :class:`.Rewriter` in the ``env.py`` file, where they will now be
part of the rendered Python code in revision files.  Pull request courtesy
of Louis-Amaury Chaib (@lachaib).

Closes: #1446
Pull-request: https://github.com/sqlalchemy/alembic/pull/1446
Pull-request-sha: 90c9735767af1cf3ba7e40e71dfa0fb30efc1ee8

Change-Id: I6b0a5ffaf7e2d1a0a1e1f1e80ed0ee168ae2bd09
alembic/autogenerate/render.py
docs/build/unreleased/1446.rst [new file with mode: 0644]
tests/test_autogen_render.py