]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Update of the no-empty-migrations snippet to work with alembic check
authorSebastian Bayer <BayerSe@gmail.com>
Wed, 25 Oct 2023 13:26:51 +0000 (09:26 -0400)
committersqla-tester <sqla-tester@sqlalchemy.org>
Wed, 25 Oct 2023 13:26:51 +0000 (09:26 -0400)
### Description
Update of the no-empty-migrations snippet to work with alembic check, see https://github.com/sqlalchemy/alembic/discussions/1332

### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)

-->

This pull request is:

- [ x] 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!**

Closes: #1338
Pull-request: https://github.com/sqlalchemy/alembic/pull/1338
Pull-request-sha: eeb7cdab9559b0500be8f1543fad97f5305f2b0f

Change-Id: Ic23efda1fc33686605ccd07437afc057cfc98574

docs/build/cookbook.rst

index f5cf6cbbc685c12a789c21c1768d97361089f1fb..cde139146ee65a711676fab02c7d6ce6fc2ab5fa 100644 (file)
@@ -917,7 +917,7 @@ any operations::
             directives: list[MigrationScript],
         ):
             assert config.cmd_opts is not None
-            if config.cmd_opts.autogenerate:
+            if getattr(config.cmd_opts, 'autogenerate', False):
                 script = directives[0]
                 assert script.upgrade_ops is not None
                 if script.upgrade_ops.is_empty():