Answer the question
In order to leave comments, you need to log in
Why is the sequence not updated when migrating the database via flyway?
Good afternoon!
Here is a simple example:
The database used is PostgresSQL.
Stack used: Spring Boot + Hibernate + FlyWay
@Data
@Entity
@Table(name = "books")
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long bookId;
//....
}
create table if not exists books
(
book_id bigserial not null
constraint books_pkey
primary key,
language_id bigint
constraint fksp7ty25kndaxyfrgkrloo1dd8
references author
);
INSERT INTO "public"."books" ("book_id", "author_id") VALUES (1, 2);
SELECT last_value FROM books_book_id_seq;
last_value 0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question