ETC / / 2023. 5. 23. 15:39

[Error] Spring config - Error executing DDL "alter table goal drop foreign key

728x90

Spring framework application config와 관련된 에러이다.

 

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table team drop foreign key FKdyddawruqdwvuy3n6kgmc4q4j" via JDBC Statement
at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlString(SchemaDropperImpl.java:419) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applySqlStrings(SchemaDropperImpl.java:403) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.applyConstraintDropping(SchemaDropperImpl.java:373) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.dropFromMetadata(SchemaDropperImpl.java:256) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]
at org.hibernate.tool.schema.internal.SchemaDropperImpl.performDrop(SchemaDropperImpl.java:178) ~[hibernate-core-6.1.7.Final.jar:6.1.7.Final]

spring:
  datasource:
    url: jdbc:tc:mysql:///javatest
    driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver  #tc 사용드라이버를 jdbc로 설정
  jpa:
    hibernate:
      ddl-auto: create-drop #테스트 시에는 create_drop으로 쓴다
    generate-ddl: true

spring.jpa.hibernate.ddl-auto를 create-drop으로 두어서 나는 오류인데

테이블이 없다보니 drop할 것이 없어서 에러가 난다.

 

update로 변경하면 바로 해결

300x250
  • 네이버 블로그 공유
  • 네이버 밴드 공유
  • 페이스북 공유
  • 카카오스토리 공유