Last active
October 27, 2021 04:11
-
-
Save bastman/3cc9e7663b55d0a5245997a651345046 to your computer and use it in GitHub Desktop.
postgres - update enum values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/ | |
ADD VALUE (PG 9.x) | |
========= | |
# PG 9.6: works from flyway. | |
ALTER TYPE AUDIT_DATABASE_EVENT_TYPE ADD VALUE 'foo'; | |
RENAME VALUE (PG 10.x) | |
============= | |
# PG 10.+: works from flyway (not supported in PG 9.x) | |
ALTER TYPE AUDIT_DATABASE_EVENT_TYPE RENAME VALUE 'foo' TO 'bar'; | |
# more tricks ... | |
see: https://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment