Ich bin neu in Java und versuche, eine erste API einzurichten.
Code: Select all
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5433/portfolio
spring.datasource.username=postgres
spring.datasource.password=123456
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto=none
< /code>
Beim Versuch, Migrationen mit Flyway < /code> mit dem Befehl: < /p>
MVN Flyway: Migrate < /p>
< /Blockquote>
So sieht der pom.xml
für flyway aus wie:
Code: Select all
org.flywaydb
flyway-maven-plugin
10.7.1
__
filesystem:src/main/resources/db/migration/portfolio
jdbc:postgresql://localhost:5433/portfolio
postgres
123456
org.flywaydb
flyway-core
10.7.1
Bearbeiten - Hinzufügen von Docker -Compose wie angefordert
Code: Select all
version: "3.8"
volumes:
db:
services:
postgresdb:
container_name: postgres_container
image: postgres
restart: unless-stopped
env_file: ./.env
environment:
- POSTGRES_USER=$POSTGRESDB_USER
- POSTGRES_PASSWORD=$POSTGRESDB_ROOT_PASSWORD
- POSTGRES_DB=$POSTGRESDB_DATABASE
ports:
- $POSTGRESDB_LOCAL_PORT:$POSTGRESDB_DOCKER_PORT
volumes:
- db:/var/lib/postgres
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 5050
ports:
- '5050:5050'
< /code>
.env Datei < /p>
POSTGRESDB_USER=postgres
POSTGRESDB_ROOT_PASSWORD=123456
POSTGRESDB_DATABASE=portfolio
POSTGRESDB_LOCAL_PORT=5433
POSTGRESDB_DOCKER_PORT=5432
Ich bin neu in Java und versuche, eine erste API einzurichten.[code]spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://localhost:5433/portfolio
spring.datasource.username=postgres
spring.datasource.password=123456
spring.datasource.driverClassName=org.postgresql.Driver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.ddl-auto=none
< /code>
Beim Versuch, Migrationen mit Flyway < /code> mit dem Befehl: < /p>
MVN Flyway: Migrate < /p>
< /Blockquote>
So sieht der pom.xml [/code] für flyway aus wie:
[code]
org.flywaydb
flyway-maven-plugin
10.7.1
__
filesystem:src/main/resources/db/migration/portfolio
jdbc:postgresql://localhost:5433/portfolio
postgres
123456
org.flywaydb
flyway-core
10.7.1
[/code]
[b] Bearbeiten - Hinzufügen von Docker -Compose wie angefordert [/b]
[code]version: "3.8"
volumes:
db:
services:
postgresdb:
container_name: postgres_container
image: postgres
restart: unless-stopped
env_file: ./.env
environment:
- POSTGRES_USER=$POSTGRESDB_USER
- POSTGRES_PASSWORD=$POSTGRESDB_ROOT_PASSWORD
- POSTGRES_DB=$POSTGRESDB_DATABASE
ports:
- $POSTGRESDB_LOCAL_PORT:$POSTGRESDB_DOCKER_PORT
volumes:
- db:/var/lib/postgres
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL:
[email protected]PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_LISTEN_PORT: 5050
ports:
- '5050:5050'
< /code>
.env Datei < /p>
POSTGRESDB_USER=postgres
POSTGRESDB_ROOT_PASSWORD=123456
POSTGRESDB_DATABASE=portfolio
POSTGRESDB_LOCAL_PORT=5433
POSTGRESDB_DOCKER_PORT=5432
[/code]