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

Add support for renaming labels in PostgreSQL enums #598

Open
kvch opened this issue Jan 16, 2025 · 2 comments
Open

Add support for renaming labels in PostgreSQL enums #598

kvch opened this issue Jan 16, 2025 · 2 comments
Labels
enhancement New feature or request sql2pgroll Issues relating to the sql2pgroll package

Comments

@kvch
Copy link
Contributor

kvch commented Jan 16, 2025

We should add support for a simple way to rename a label in an enum. PostgreSQL does not support renaming labels. PostgreSQL users have to drop the old enum and recreate it with the new label.

Other enum related operations are good enough as raw migrations.

@kvch kvch added enhancement New feature or request good first issue Good for newcomers sql2pgroll Issues relating to the sql2pgroll package labels Jan 16, 2025
@kvch kvch changed the title Add support for creating types Add support for managing types Jan 16, 2025
@andrew-farries
Copy link
Collaborator

How would this behave with multiple-schema versions?

Is this something that should be done with a raw SQL migration rather than adding a new pgroll operation?

@kvch kvch changed the title Add support for managing types Add support for managing enumerated types Jan 20, 2025
@kvch kvch removed the good first issue Good for newcomers label Jan 20, 2025
@kvch
Copy link
Contributor Author

kvch commented Jan 20, 2025

Creating a new enum type, dropping an existing enum type and adding new label to an enum is a simple operation, it does not need its own dedicated pgroll migration. Pgroll is meant to support users in migrations that need two schema version at the same time or to avoid unnecessary locking of tables.

Renaming existing labels in an enum type could be a potential new operation, as it consists of several steps (dropping the old and recreating the enum with new label name), and database clients might want to use both old and new label name during the testing phase.

@kvch kvch changed the title Add support for managing enumerated types Add support for renaming labels in PostgreSQL enums Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sql2pgroll Issues relating to the sql2pgroll package
Projects
None yet
Development

No branches or pull requests

2 participants