Çalıştırmak için şöyle yaparız
$ mvn liquibase:update
Elimizde şöyle bir şey olsun
<properties><java.version>17</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>${java.version}</maven.compiler.source><maven.compiler.target>${java.version}</maven.compiler.target><!-- Liquibase properties --><liquibase-maven-plugin.version>4.16.1</liquibase-maven-plugin.version><mysql.version>8.0.30</mysql.version><db.url>jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=UTF-8&createDatabaseIfNotExist=true</db.url><db.username>root</db.username><db.password></db.password></properties>
Şu satırı dahil ederiz. changeLogFile ile sql dosyalarının yerini belirtiriz.
<plugin><!-- Liquibase plugin --><groupId>org.liquibase</groupId><artifactId>liquibase-maven-plugin</artifactId><version>${liquibase-maven-plugin.version}</version><configuration><changeLogFile>${project.basedir}/db/changelog-master.yml</changeLogFile><!-- DB connection config --><driver>com.mysql.jdbc.Driver</driver><url>${db.url}</url><username>${db.username}</username><password>${db.password}</password></configuration><dependencies><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.version}</version><scope>runtime</scope></dependency></dependencies></plugin>
db dizinindeki changelog-master.yml şöyledir
databaseChangeLog: - includeAll: - path: changes - relativeToChangelogFile: true
changes dizininde şu dosyalar vardır
001_createTablePerson.yml 002_addColumnUsername.yml 003_addLookupTableState.yml
Hiç yorum yok:
Yorum Gönder