Specify the Sequence Name When Creating Table in Postgres
Context
In a Spring boot project, using JPA to access database, using flyway to migrate database.
Problem
By default, when creating a table in Postgres with a generated column, it's name will be <table>_<column>_seq
, but the JPA will try to find the sequence with name <table>_seq
. So, the JPA will complain that it can't find the sequence.
Solution
To delight the JPA, it's required to change the sequence name when creating table like the following.