I am migrating from real postgres testing to testContainers using spring-boot. The test fails with this exception:
Reason: liquibase.exception.DatabaseException: ERROR: update or delete on table "table1" violates foreign key constraint "fk30d6gcohuxxjs6f3cqwtbtu69" on table "table2"
Détail : Key (id)=(2152) is still referenced from table "table2". [Failed SQL: (0) DELETE FROM table1]
// application.yml
...
spring:
datasource:
type: com.zaxxer.hikari.HikariDataSource
hikari:
auto-commit: false
poolName: Hikari
maximum-pool-size: 1
jpa:
database-platform: tech.jhipster.domain.util.FixedPostgreSQL10Dialect
open-in-view: false
hibernate:
ddl-auto: none
naming:
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
properties:
hibernate.id.new_generator_mappings: true
hibernate.connection.provider_disables_autocommit: true
hibernate.cache.use_second_level_cache: false
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
hibernate.hbm2ddl.auto: validate
hibernate.jdbc.time_zone: UTC
hibernate.query.fail_on_pagination_over_collection_fetch: true
// changeset file (liquibase)
<addForeignKeyConstraint constraintName="fk_name"
baseTableName="table2"
baseColumnNames="table2_id"
referencedTableName="table1"
referencedColumnNames="id"
onDelete="CASCADE"/>
Is there any configuration for testContainers in order to accept cascade delete ?
Spring-boot version: 2.7.3
liquibase version: 3.7.0
testContainers version: 1.17.3
Jhipster version: 7.9.3