@@ -26,15 +26,16 @@ Add the following Maven **runtime** dependency to your project:
26
26
27
27
### Hibernate
28
28
29
- Users of Hibernate typically annotate the enum columns with
29
+ For Hibernate entities, we recommend annotating attributes of enum type as shown below:
30
30
``` java
31
31
@JdbcType (PostgreSQLEnumJdbcType . class)
32
32
Status status;
33
33
```
34
- where ` Status ` is an enum class.
35
34
36
35
## Commands ##
37
36
37
+ The library provides additional liquibase commands, that can be used within a ` changeSet ` :
38
+
38
39
### Creating an enum type
39
40
40
41
``` xml
@@ -55,8 +56,8 @@ where `Status` is an enum class.
55
56
56
57
### Removing one or more values of an existing enum
57
58
58
- PostgreSQL does not yet support removing of values of an existing enum. Instead, we implement a workaround described in
59
- https://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/ by replacing the enum with a new enum type that has different values.
59
+ PostgreSQL does not yet support removing of values of an existing enum. Instead, we implement a workaround
60
+ by replacing the enum with a new enum type that has different values (as described in [ this blog post ] [ yo1dog-blog ] ) .
60
61
61
62
⚠ You need to be extra careful when you drop an enum value! First, you need to update the existing tables
62
63
to make sure that the value is not used anymore, typically using an ` UPDATE ` statement.
@@ -84,3 +85,4 @@ to make sure that the value is not used anymore, typically using an `UPDATE` sta
84
85
85
86
[ postgresql-enums ] : https://www.postgresql.org/docs/current/datatype-enum.html
86
87
[ liquibase-changelog-generator ] : https://github.com/cronn/liquibase-changelog-generator
88
+ [ yo1dog-blog ] : https://blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/
0 commit comments