User Tools

Site Tools


database:liquibase

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
database:liquibase [2020/05/18 15:39] skipidardatabase:liquibase [2023/11/01 07:13] (current) – ↷ Page moved from business_process_management:camunda:database:liquibase to database:liquibase skipidar
Line 136: Line 136:
  
 </code> </code>
 +
 +
 +
 +=== With Spring Boot ===
 +
 +
 +== INit the DB at start ==
 +
 +To init the table - you only need the core **org.liquibase:liquibase-core** (no plugin)
 +
 +build.gradle
 +<sxh perl>
 +dependencies {
 +    // liquibase
 +    compile 'org.liquibase:liquibase-core:3.9.0'
 +
 +    // get the to the classpath which is needed but not loaded with "ddl-auto=none" and liquibase enabled
 +    compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.11.0'
 +
 +}
 +</sxh>
 +
 +
 +application.properties
 +<sxh perl>
 +# https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html
 +spring.datasource.driver-class-name=org.postgresql.Driver
 +spring.datasource.username=postgres
 +spring.datasource.password=postgres
 +spring.datasource.host=localhost
 +spring.datasource.port=5432
 +spring.datasource.database=postgres
 +spring.datasource.url=jdbc:postgresql://${spring.datasource.host}:${spring.datasource.port}/${spring.datasource.database}
 +
 +
 +
 +# Liquibase without prefix
 +#spring.liquibase.enabled=false
 +spring.liquibase.enabled=true
 +spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
 +spring.liquibase.default-schema=public
 +spring.liquibase.user=postgres
 +spring.liquibase.password=postgres
 +
 +# will be taken from spring.*  like spring.datasource.host
 +#spring.liquibase.host=localhost
 +#spring.liquibase.port=5432
 +#spring.liquibase.database=postgres
 +#spring.liquibase.driver=org.postgresql.Driver
 +</sxh>
 +
 +resources/db/changelog/db.changelog-master.yaml
 +<code>
 +databaseChangeLog:
 +  - includeAll:
 +      path: db/changelog/generated/
 +</code>
 +
 +resources/db/changelog/generated/dbchangelog-1589882779384.xml
 +<code>
 +<?xml version="1.1" encoding="UTF-8" standalone="no"?>
 +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
 +    <changeSet author="vagrant (generated)" id="1589882779384-1">
 +        <createTable tableName="tags">
 +            <column name="name" type="VARCHAR(255)">
 +                <constraints nullable="false" primaryKey="true" primaryKeyName="tags_pkey"/>
 +            </column>
 +        </createTable>
 +    </changeSet>
 +    
 +    ...
 +</code>
 +
  
database/liquibase.1589816361.txt.gz · Last modified: (external edit)