Warum Wenn ich mein Projekt mit Java 8, Spring Boot, Liquibase und Postgresql ausführe, wird in meiner Postgres-Datenbank keine neue Tabelle angezeigt? Ich habe PostgreSQL 11.6 installiert.
Dies ist changelog-master.xml:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<include file="/db/changelog/changes/create-table-changelog-1.xml"/>
</databaseChangeLog>
Dies ist create-table-changelog-1.xml
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="admin" id="1">
<createTable tableName="person11">
<column autoIncrement="true" name="id" type="INT">
<constraints primaryKey="true"/>
</column>
<column name="name" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="address" type="VARCHAR(255)"/>
</createTable>
<!-- <rollback>
<dropTable tableName="person11"/>
</rollback>-->
</changeSet>
</databaseChangeLog>
Dies ist application.properties:
spring.liquibase.changeLog = classpath:/db/changelog/changelog-master.xml
spring.datasource.url= jdbc:postgresql://localhost:5432/
spring.datasource.username=postgres
spring.datasource.password=postgres
Dies ist die Datei pom.xml:
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.8.9</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.14</version>
<scope>compile</scope>
</dependency>
Vielen Dank für Ihre Antworten. Als ich diesem Link folgte, ist mein Problem gelöst. In diesem Link finden Sie ein Beispiel für die Integration von Spring-Boot, JPA und Liquibase: https://auth0.com/blog/integrating-spring-data-jpa-postgresql-liquibase/
Dieser Artikel stammt aus dem Internet. Bitte geben Sie beim Nachdruck die Quelle an.
Bei Verstößen wenden Sie sich bitte [email protected] Löschen.
Lass mich ein paar Worte sagen