postgresql - postgres docker error alter table offer_company_favorite drop constraint FKa9qoi1pliuiby09jipnl6xts6" via JDBC Statement
问题描述
hi i have error alter table offer_company_favorite drop constraint FKa9qoi1pliuiby09jipnl6xts6" via JDBC Statement" when i started my docker-compose . this link of my project https://gitlab.com/MisterThomas/wesharejoblocal i only work for now with weShareJob-service-offer after i result i working authentication.
spring.datasource.url=jdbc:postgresql://postgresdb:5432/offer
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=update
logging.level.org.hibernate.sql=DEBUG
logging.level.org.hibernate.type.descriptor.sql=trace
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
#spring.jpa.hibernate.ddl-auto=none
springdoc.api-docs.path=/api-docs
server.port=8085
spring.devtools.restart.log-condition-evaluation-delta=false
this my classe offer_company_favorite
model offer
@Entity
@Table(name="offercompanyfavorites")
public class OfferCompanyFavorite {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
variables
@Column(name = "username")
private String username;
@Column(name = "date_scrap_offer")
private Date date_scrap_offer;
@Column(nullable = false, name = "is_active")
private Boolean is_active;
forgein key
@ManyToOne
@JoinColumn(name = "offercompany_id", nullable = true)
private OfferCompany offercompany;
constructor
@JsonCreator
public OfferCompanyFavorite(String username, Date date_scrap_offer, Boolean is_active) {
this.username = username;
this.date_scrap_offer = date_scrap_offer;
this.is_active = is_active;
}
public OfferCompanyFavorite(Long id,String username, Date date_scrap_offer, Boolean is_active) {
this.id = id;
this.username = username;
this.date_scrap_offer = date_scrap_offer;
this.is_active = is_active;
}
public OfferCompanyFavorite(Long id,String username, Date date_scrap_offer, Boolean is_active,OfferCompany offercompany) {
this.id = id;
this.username = username;
this.date_scrap_offer = date_scrap_offer;
this.is_active = is_active;
this.offercompany = offercompany;
}
getter ans setter
public OfferCompanyFavorite() {
}
public long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(final String username) {
this.username = username;
}
public Boolean getIs_active() {
return is_active;
}
public void setIs_active(Boolean is_active) {
this.is_active = is_active;
}
public OfferCompany getOffercompany() {
return offercompany;
}
public void setOffercompany(final OfferCompany offercompany) {
this.offercompany = offercompany;
}
public Date getDate_scrap_offer() {
return date_scrap_offer;
}
public void setDate_scrap_offer(Date date_scrap_offer) {
this.date_scrap_offer = date_scrap_offer;
}
@Override
public String toString() {
return "OfferCompanyFavorite [" +
"id=" + id +
", username=" + username +
", date_scrap_offer=" + date_scrap_offer +
", is_active=" + is_active +
", offercompany=" + offercompany +
"]";
}
}
docker-compose.yml
version: "3"
services:
postgresdb:
image: postgres:latest
container_name: postgresdb
volumes:
- postgres-data:/var/lib/postgresql/data
expose:
- 5432
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=offer
restart: unless-stopped
# APP*****************************************
offer:
image: offer:latest
container_name: offer
expose:
- 8085
ports:
- 8085:8085
restart: unless-stopped
depends_on:
- postgresdb
links:
- postgresdb
volumes:
postgres-data:
thanks for you help :)
解决方案
推荐阅读
- elasticsearch - Elasticsearch 为什么我的查询匹配太慢?
- react-native - FormData 在 react-native 中发送字符串值而不是视频文件
- angular - 在快车上的角度和其他路线之间导航
- reporting-services - 自动管理失败的 ssrs 订阅
- ubuntu-18.04 - 由于 rosout 未构建,Roscore 无法运行
- ios - UILabel 行数计算返回一个额外的行
- vue.js - 如何从 VueJS 中的 http 响应中获取标头?
- javascript - 'mouseover' 和 'mouseleave' 的事件监听器
- python - 分块读取大文件,分块压缩和写入
- python - 使用 Lambda 上传到 S3