liquibase

Liquibase JPA configuration of the referenceUrl

爷,独闯天下 提交于 2020-01-15 10:38:06
问题 I am struggling to build the JPA annotated classes diff changesets against my database, using liquibase . Still, I am very confused about few things. I use the following : liquibase.properties #liquibase.properties driver: org.postgresql.Driver classpath: real_path/.m2/repository/org/postgresql/postgresql/9.2-1002-jdbc4/postgresql-9.2-1002-jdbc4.jar url: jdbc:postgresql://localhost:5432/diquiz username: postgres password: postgres referenceUrl: hibernate:ejb3:diQuiz referenceUsername:

Set max column value as sequence start value with liquibase tags

牧云@^-^@ 提交于 2020-01-14 07:15:45
问题 I wonder if it possible to get maximum column value from a certain table and set it as start sequence value with no pure sql. The following code doesn't work: <property name="maxId" value="(select max(id)+1 from some_table)" dbms="h2,mysql,postgres"/> <changeSet author="author (generated)" id="1447943899053-1"> <createSequence sequenceName="id_seq" startValue="${maxId}" incrementBy="1"/> </changeSet> Got an error: Caused by: liquibase.parser.core.ParsedNodeException: java.lang

jhipster liquibase doesn't update database

[亡魂溺海] 提交于 2020-01-13 16:24:11
问题 I m trying to add a new entity, I don't use the full hot reload, so I created a db-changelog-002.xml file with the new table to be created in the changeset of the file. Then I ran a mvn spring-boot:run, but my database doesn't get updated with the new table. Is it normal? Thank you in advance. 回答1: You must add your file to master.xml file, like below. <include file="classpath:config/liquibase/changelog/db-changelog-002.xml" relativeToChangelogFile="false"/> 回答2: No Need to create another db

Java Hibernate, Liquibase supports cross databases and SQLite?

风流意气都作罢 提交于 2020-01-07 05:03:56
问题 I'm using Spring Boot 1.5.2 with Hibernate 5 and try to support as many databases as possible (i.e: Hibernate will create all the tables in SQLite 3, then I use Liquibase as an abstract layer to generate the XML change-log files for all kind of supported databases which Liquibase claimed: supported databases). so I added the dependency for Liquibase in pom.xml (Maven). <!-- Database schema versions migration --> <dependency> <groupId>org.liquibase</groupId> <artifactId>liquibase-core<

Liquibase 使用(全)

﹥>﹥吖頭↗ 提交于 2020-01-07 00:19:55
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 聊一个数据库脚本的版本工具 Liquibase, 官网在这里 ,初次看到,挺神奇的,数据库脚本也可以有版本管理,同类型的工具还有 flyway 。 开发过程经常会有表结构和变更,让运维来维护的话,通常会有很大的沟通成本,有时在开发方案有问题的时候,提测失败整个项目需要回滚,代码回滚起来是很容易的,通常有备份,但数据库的话就要人工来逐行分析并写出回滚语句,Liquibase 这时候就有用了。 Liquibase 适用场景感觉不多,所以可能有人没听过它的名头; 首先这种自动执行的家伙肯定是不适合于生产环境的,然后在数据量大的时候是不可能用数据库自带的 alter 语句的,一般都是手动创建另一张表,然后用 sql 语句将数据批量复制过去,再者使用容器化也比它好,个人觉得它一般用于开发和测试环境,比较厉害的一个功能是可以比较两个库的差异然后生成补丁包,上线时可以这么玩。 这篇文章 说得不错,我是在这篇基本上写的 核心概念 首先它是用于管理数据库版本的,所以就会有这些概念:版本号,管理的数据,差异比较,版本回滚 它的版本号由开发人员来维护,使用 author + id 管理的数据最小单元为 changeSet ,这个 changeSet 看官网说是可以用 xml,yaml,json,sql 来编写 提交数据,比较差异

How does flyway / liquibase handle destructive upgrades in service?

筅森魡賤 提交于 2020-01-06 12:20:38
问题 Based on my understanding about flyway/liquibase, they provide ways to perform database upgrades through the pre configured scripts (SQL queries, Java files, etc.,). But i am not very much clear about the following : What happens if there is destructive upgrade. I have a use case like changing an bigint column(containing data) to date type. If i try to change it directly, i will end up with corrupted data for the column. How does flyway/liquibase handle these kinds of upgrades ? Whether pre

Compare two hibernate mapping files

孤人 提交于 2020-01-06 08:22:05
问题 I would like liquibase to compare two hibernate mappings instead of a database as source and a hibernate mapping as reference: liquibase --changeLogFile=c:/tmp/changelog.xml --url=hibernate:classic:c:/tmp/a.xml --referenceUrl=hibernate:classic:c:/tmp/b.xml diffChangeLog That does not seem to work as I am getting an exception: Liquibase diffChangeLog Failed: org.hibernate.HibernateException: /tmp/a.xml not found Is that supposed to work? The idea is to compare two versions (svn revisions) of

skipping liquibase change if table exists

本秂侑毒 提交于 2020-01-06 05:52:27
问题 New to liquibase. I have an existing schema managed by hibernate. I now need to remove some tables and I'm using liquibase. I wrote a config that succesfully deletes the table. But I want the check to run only if the table exists, since a new install of the system would not have the table since the hibernate mapping objects no longer exist. I attempted to add a precondition. However, my logs still indicating that liquibase is failling becuase it tries to delete the table and it doesn't exist.

How can I set the Liquibase database connection timeout and retry count?

社会主义新天地 提交于 2020-01-05 07:20:12
问题 How can I set the time that Liquibase waits to establish a connection to a database server (specifically, PostgreSQL) before failing (i.e. the connection timeout)? How can I set the number of times that Liquibase will attempt to connect to a database server before aborting (i.e. the connection retry count)? 回答1: Liquibase uses a jdbc connection. According to this answer network timeout was only introduced to JDBC from spec 4.1 on. According to postgres jdbc doc there is a property like

using spring boot profiles with liquibase changeset context attribute to manage changset scope

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 11:04:35
问题 I am trying to do a proof of concept application with spring boot and liquibase. I basically want to create a spring boot app that can manage liquibase changesets by utilizing the changeset attribute called context, so that changesets with no context can be applied to any spring boot profile, whereas changesets with specific context (e.g context="dev" ) will only be applied if spring boot profiles of that type, is active (e.g spring.profiles.active=dev). In my app, i have the following spring