newbie to quarkus - facing issue with flyway

89 views
Skip to first unread message

Abdullah Umer

unread,
Oct 16, 2021, 1:10:29 PM10/16/21
to Quarkus Development mailing list
Hi

I am a beginner in quarkus. I have started a project for developing a backend with postgresql db. I added flyway for handling the db schema migrations.

In the beginning I had added a string field to the entity which was non-nullable. Later on the requirement changed and this field has to be removed. I found that the schema is not updated and is throwing an error when I try adding new objects without that removed field. 

I tried searching a lot but could not find a solution. I can drop the database and create new but I'm afraid what will happen if the product goes live and later we want to make changes like this then dropping the database is not an option. 

Could anyone explain how can I take care of such situation in production?

I have used MongoDB in my last project and it was very easy. I could add/remove fields without any issues.

public class User extends PanacheEntity {

// @NotNull
// @Size(max = 100, min = 2)
// @Column(length = 100, nullable = false, unique = false)
// public String title; This is the field no more required

@JsonIgnore
@Password
String password;
...... some more fields
}

Error:
org.postgresql.util.PSQLException: ERROR: null value in column "title" of relation "users" violates not-null constraint Detail: Failing row contains (User, 12, null, 2021-10-16 18:09:27.042, te...@test.com, 2, null, null, null, test.jpg, USER, null). at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2552) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2284) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322) at org.postgresql.jdbc.PgStatement.ex......

Any help would be appreciated.

Thank you!
Reply all
Reply to author
Forward
0 new messages