Skip to content

Do not ignore Alembic migration context prefixes when generating migrations #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

Jazzinghen
Copy link

@Jazzinghen Jazzinghen commented Apr 24, 2025

Description

When generating the migrations alembic-postgresql-enum assumes that both SQLalchemy and Alembic's module prefixes are the default ones.

To fix this issue the following changes have been introduced:

  • Extract both information when creating Enums and use them in the generated python strings
  • Extract Alembic module prefix when handling Enum synchronizations
  • Updated testing framework to customize the migration environment for a test
  • Added a schema creation test with custom module prefixes

I had to disable running the test TestNewArrayColumnColumnCustomContext as how they are executed does not allow (at least to the extent of my knowledge) using "nested" modules (e.g. alembic.op breaks with FAILED sync_enum_values/test_run_array_new_column.py::TestNewArrayColumnColumnCustomContext::test_run - NameError: name 'alembic' is not defined).

Checklist

This pull request is:

  • A documentation / typographical / small typing 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant