Skip to content
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

Ability to use include_name from alembic context #89

Open
amithkk opened this issue Dec 2, 2024 · 1 comment
Open

Ability to use include_name from alembic context #89

amithkk opened this issue Dec 2, 2024 · 1 comment

Comments

@amithkk
Copy link

amithkk commented Dec 2, 2024

Sometimes, there are enums in the schema that need to be ignored or which are controlled by other applications.

To address this, alembic has a feature to pass in include_name, where you can pass a function that determines whether change detection will consider the object for migration generation.

However, alembic-postgresql-enum does not use this function before calculating changes. If this were implemented, you could do something along the lines of:

def include_name(name, type_, parent_names):
    if type_ == "enum":
        return name not in ["exclude_enum_1", "exclude_enum_2"]
    else:
        return True

context.configure(
    # ...
    include_name = include_name
)
@dswistowski
Copy link
Contributor

dswistowski commented Dec 2, 2024

@amithkk I literally today needed such feature, and added it in my fork 🤣 #90

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

No branches or pull requests

2 participants