### 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
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():