【发布时间】:2020-08-28 18:16:02
【问题描述】:
我正在关注这个教程:https://www.youtube.com/watch?v=vtPkZShrvXQ
…我在数据库迁移方面遇到了麻烦。我使用的是 Spring Boot 2.2.7,并创建了一个名为“demodb”的 PostgreSQL 数据库
当我运行程序时,控制台报错:
org.postgresql.util.PSQLException: FATAL: 数据库“demodb”不存在
这是我的 application.yml 文件,其中包含数据库信息:
app:
datasource:
plaltform: postgres
jdbc-url: jdbc:postgresql://localhost:5432/demodb
username: postgres
password: password
pool-size: 30
这是我在 pom.xml 文件中的依赖项:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
</dependencies>
我在一个单独的文件夹中运行我的迁移,就像我说的,数据库“demodb”确实存在(我从终端创建了它),所以我不确定我为什么会收到这个错误。有什么想法吗?
【问题讨论】:
标签: java postgresql spring-boot docker flyway