Questions tagged [liquibase]
Liquibase is an open source, database-independent library for tracking, managing and applying database changes. It is built on a simple premise: All database changes are stored in a human readable yet trackable form and checked into source control.
3,841
questions
408
votes
12
answers
381k
views
Liquibase lock - reasons?
I get this when running a lot of liquibase-scripts against a Oracle-server. SomeComputer is me.
Waiting for changelog lock....
Waiting for changelog lock....
Waiting for changelog lock....
Waiting ...
121
votes
4
answers
167k
views
List all liquibase sql types
I try to find documentation on the supported types that can be used in change log files.
But cannot find it.
Is there any document, site or something similar where I can find all types-specific issues....
118
votes
8
answers
46k
views
Why and when Liquibase?
I have searched for this answer on stack overflow, but I couldn't find any questions on this.
I am new to Liquibase and want to learn
Why Liquibase?
When exactly one should use Liquibase in the ...
83
votes
10
answers
108k
views
Spring boot - disable Liquibase at startup
I want to have Liquibase configured with my Spring Boot application, so I added dependencies to pom.xml and set the path to master.xml in application.properties. This works fine and Spring Boot runs ...
71
votes
9
answers
173k
views
Liquibase checksum validation error without any changes
Maven fires liquibase validation fail even no changes was made in changeset.
My database is oracle.
Situation:
In DB changelog table was record for changeset <changeSet id="1" author="me" dbms="...
70
votes
4
answers
98k
views
Liquibase: How to Set Foreign Key(s) Constraint in Column Tag?
How can I configure foreign keys through column tag attributes foreignKeyName and references? The only example I've found demonstrates how to add foreign keys after the fact.
62
votes
3
answers
112k
views
How can I force Liquibase to recalculate checksums without re-running the statements?
We're using Liquibase 3.2 with Java 6. Is there a way I can force Liquibase to recalculate checksums without re-running the same statements from our Liquibase files? In our database, I run this ...
...
59
votes
3
answers
38k
views
Java code changeset in liquibase
Is there a way in liquibase to create java code change set (i.e. provide a java class, which will receive a JDBC connection and will perform some changes in the database) ?
(I know that flyway has ...
55
votes
8
answers
87k
views
Liquibase: How to set the default value of a date column to be "now" in UTC format?
How do you set the default value of a date column to be "now" in UTC format? I think the answer involves the defaultValueComputed attribute on the column element.
The documentation states:
...
44
votes
3
answers
53k
views
Adding composite unique constraint in Liquibase
I'm creating a link table which has 3 columns; id, product_id, tournament_id.
Adding a uniqueConstraint to the "id" column is trivial, but I want to ensure that any pair of (product_id, tournament_id)...
41
votes
10
answers
22k
views
Liquibase error [Postgresql]: unterminated dollar-quoted string at or near "$BODY$
Liquibase error: unterminated dollar-quoted string at or near "$BODY$`
Chaneg log xml has one entry: see below
include file="/home/dev/....../admin_script.sql"
content of the file:
.......
41
votes
3
answers
80k
views
Update one row in the table, using liquibase
I was hoping if someone could verify if this is the correct syntax and correct way of populating the DB using liquibase? All, I want is to change value of a row in a table and I'm doing it like this:
...
41
votes
1
answer
14k
views
Liquibase or Flyway database migration alternative for Elasticsearch
I am pretty new to ES. I have been trying to search for a db migration tool for long and I could not find one. I am wondering if anyone could help to point me to the right direction.
I would be using ...
40
votes
4
answers
42k
views
Running liquibase within Java code
For some reason there's no documentation on running liquibase inside Java code. I want to generate tables for Unit tests.
How would I run it directly in Java?
e.g.
Liquibase liquibase = new ...
38
votes
10
answers
66k
views
liquibase <insert> : Insert current date
I am trying to insert data using liquibase insert tag. It works fine when I am inputing a number to value tag .
But I am looking for a simple function that will take care of default date (current ...
37
votes
1
answer
17k
views
Hibernate using JPA (annotated Entities) and liquibase
liquibase is a perfect alternative to hibernate's hbm2ddl_auto property if you are using xml-mapping. But Im using JPA annotation (hibernate annotations). Is it possible to use liquibase then?
36
votes
3
answers
49k
views
How to work with liquibase, a concrete example
Following the quickstart on liquibase i've created a changeset (very dumb :) )
Code:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/...
36
votes
4
answers
29k
views
How to get liquibase to log using slf4j?
A lot of people are unsure how to fix logging for liquibase, either to the console or file.
Is it possible to make liquibase log to slf4j?
34
votes
2
answers
27k
views
Flyway and liquibase together? [closed]
I've looked at both Liquibase and Flyway individually and on an individual comparison alone, Liquibase seems like the better tool for our needs. Some sources mention using both Liquibase and Flyway ...
34
votes
1
answer
18k
views
Using liquibase on the existing database
We have a existing database in production. We have decided to use liquibase for all further updates and create any new database (like development or integration).
We have created liquibase scripts ...
33
votes
1
answer
41k
views
Liquibase - disable checksum?
How can I disable checksum validation in Liquibase?
It looks like Liquibase does not provide such feature. Would it be hard to modify Liquibase to achieve that? Your opinion, please.
32
votes
6
answers
98k
views
LiquiBase problem , class path resource [db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
I am having a problem integrating liquibase with springboot.
I have added the liquibase dependency in the pom file like below:
<dependencies>
<dependency>
<...
30
votes
3
answers
86k
views
When creating a column using liquibase, how do I specify a value for that column based on an existing column?
I have an existing mysql table with two columns a and b.
I now want to add a column c to that table.
c should be nullable, should have a default value of NULL, except in those rows where column b ...
29
votes
7
answers
42k
views
Liquibase - insert rows with uuid
I have two tables declared as follows:
<changeSet author="istvan" id="country-table-changelog">
<createTable tableName="country">
<column name="id" type="uuid">
...
28
votes
3
answers
72k
views
How to tag a changeset in liquibase to rollback
I have configured the maven pluggin for liquibase as specified in maven configuration.
Now created a changeset like :-
<changeSet id="changeRollback" author="nvoxland">
<createTable ...
27
votes
3
answers
24k
views
Spring Boot: How to setup test data with liquibase in unit test
I'm trying to setup the database schema and some test data with liquibase for some tests. Each test has a separate changelog which setup the schema and some specific data for the test.
In order to ...
25
votes
4
answers
55k
views
Update type of a column in liquibase
I want to update the type of a column named "password". At the moment it has type NVARCHAR(40) and I want it to be of type NVARCHAR(64). This is what I did:
<changeSet id="1 - change password ...
25
votes
4
answers
56k
views
Alter column length with liquibase
I am having problems changing a column length in my postgres db with liquibase.
I have a table account with a field description varchar(300). I want to change it to varchar(2000).
I have dropped ...
25
votes
1
answer
58k
views
Define Changeset for insert query in liquibase
I have two table as following :
CREATE TABLE StudentMaster (
sId SERIAL,
StudentName VARCHAR(50)
);
CREATE TABLE StudentClassMap (
studnetId BIGINT UNSIGNED NOT NULL,
studentClass ...
25
votes
6
answers
8k
views
Spring Boot: run liquibase migrations without starting app
In Spring Boot, the documentation seems to encourage running migrations on app startup.
This is fine, but sometimes app startup may have side effects / dependencies that I don't want to bother with - ...
25
votes
2
answers
29k
views
Inserting lots of values (with FK's) into database using LiquiBase and Spring
I'm trying to add a lot of records (currently located in an Excel file) into my DB using Liquibase (so that I know how to do it for future DB changes)
My idea was to read the excel file using Java, ...
24
votes
5
answers
39k
views
How to set up liquibase in Spring for multiple data sources?
I need to set up liquibase for two datasources in Spring, at the moment it seems that only one liquibase set up is possible and you can choose for which data source.
24
votes
4
answers
17k
views
Liquibase inserting into BIT column, MySQL, data too long for column
In Liquibase, I define a table with a column of type BIT(1)
<changeSet author="foobar" id="create-configuration-table">
<createTable tableName="configuration">
<column ...
24
votes
4
answers
29k
views
Adding a non-nullable column to existing table fails. Is the "value" attribute being ignored?
Background: we have a Grails 1.3.7 app and are using Liquibase to manage our database migrations.
I am trying to add a new column to an existing table which is not empty.
My changeset looks like ...
24
votes
2
answers
19k
views
Liquibase Stored Proc's management
I read liquibase's best practices, specifically for managing stored procedures:
Managing Stored Procedures: Try to maintain separate changelog for Stored Procedures and use runOnChange=”true”. ...
24
votes
3
answers
47k
views
Using Liquibase to initialize in-memory H2 for unit tests in Spring Boot application
I've used in-mem databases in Spring JPA tests many times, and never had a problem. This time, I have a bit more complex schema to initialize, and that schema must have a custom name (some of the ...
24
votes
5
answers
8k
views
How to manage schema migrations in Google BigQuery
How to manage schema migrations for Google BigQuery, we have used Liquibase and Flyway in the past. What kind of tools can we use to manage schema modifications and the like (e.g. adding a new column) ...
23
votes
5
answers
24k
views
How to create schema in Postgres DB, before liquibase start to work?
I have standalone application. It’s on java, spring-boot, postgres and it has liquibase.
I need to deploy my app and liquibase should create all tables, etc. But it should do it into custom schema ...
23
votes
5
answers
14k
views
Why are all contexts executed when non specified on update?
I'm using Liquibase 3.3.5 to update my database. Having contexts is a nice way to only execute specific parts of the changelog. But I don't understand, why ALL changesets are executed, when no context ...
23
votes
3
answers
10k
views
Convert Liquibase XML to YAML?
Can I automatically convert Liquibase changelog files in the XML format to the YAML format?
22
votes
5
answers
28k
views
How to solve liquibase waiting for changelog lock problem in several pods in OpenShift cluster?
We are supporting several microservices written in Java using Spring Boot and deployed in OpenShift. Some microservices communicate with databases. We often run a single microservice in multiple pods ...
22
votes
1
answer
21k
views
altering my sql table to add multiple new columns at once using liquibase
What is the correct syntax to alter the table and adding multiple columns at a time using liquibase xml. The official document gives the example for adding only one column :
<changeSet author="...
21
votes
2
answers
45k
views
java - illegalStateException: Cannot find changelog location: class path resource (liquibase)
I am getting this error when I try to run my spring boot application. I am new to java and spring development. Please let me know if you require more info. I'm not sure what it means by "cannot find ...
21
votes
3
answers
32k
views
How to add new column with default value from existing column in Liquibase
I'm using Postgres DB and for migration I'm using Liquibase.
I have an ORDERS table with the following columns:
ID | DATE | NAME | CREATOR | ...
I need to add a new column which will hold the user ...
21
votes
3
answers
14k
views
Cant run liquibase with command line
I want to use liquibase but when I want to let it run with command line this happens:
PS C:\Users\Ferid\Downloads\liquibase-3.6.0-bin> .\liquibase
Error: A JNI error has occurred, please check ...
20
votes
4
answers
35k
views
Liquibase change existing nullable constraint from true to false
I added a column to an existing table using Liquibase changelog, and I set the nullable constraint to true.
Code:
<changeSet id="10" author="000000">
<addColumn ...
20
votes
2
answers
31k
views
enum data type for liquibase
I'm currently working on a liquibase.xml file to create table table_a. One of my fields is <column name="state" type="ENUM('yes','no')">
I'm using postgresql as my DBMS. is there anything like ...
20
votes
3
answers
20k
views
How to create liquibase changeset for integration tests in springboot?
I want mock data for integration tests by liquibase changeset, how to make that to not affect real database? I found partial idea from here, but I am using springboot and I hope there is simpler ...
20
votes
4
answers
57k
views
Liquibase - how to generate a changelog for existing database
I'm trying to use liquibase for generating the changeLog, starting by snapshoting the current state of my database.
Environment details:
OS: Windows 7 32 x86,
Java JDK 1.7,
mysql jdbc driver from ...
20
votes
2
answers
12k
views
H2 update with join
As development DB I am using MySQL, and for tests I am using H2 database.
The following script works in MySQL very well, but it is fails on H2.
UPDATE `table_a`
JOIN `table_b` ON `table_a`.id=`...