add this line to your application.properties spring.jpa.properties.hibernate.hbm2ddl.drop_constraints=false
This configuration ensures that Hibernate does not delete constraints before deleting tables.