alembic icon indicating copy to clipboard operation
alembic copied to clipboard

fix(typings): improve typing for server_default

Open sk- opened this issue 6 months ago • 0 comments

Description

Issue #1669 shows that the typings for server default were inconsistent with sqlaclhemy's definition.

In this PR we:

  • fix the definition of _ServerDefault to match that of sqlalchemy's _ServerDefaultArgument
  • use that same definition in all places that use a server_default or existing_server_default

Note that the last change also changes the default of the argument existing_server_default from False to None. This could be a breaking change, however that argument is currently typed in manyplaces as Optional[_ServerDefault] = None (and _ServerDefault does not include bool).

Fixes #1669

Checklist

This pull request is:

  • [ ] 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!

sk- avatar Jun 05 '25 21:06 sk-