Skip to content

Instantly share code, notes, and snippets.

@bastman
Last active October 27, 2021 04:11
Show Gist options
  • Save bastman/3cc9e7663b55d0a5245997a651345046 to your computer and use it in GitHub Desktop.
Save bastman/3cc9e7663b55d0a5245997a651345046 to your computer and use it in GitHub Desktop.
postgres - update enum values
// 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