liquibase

Is there a way to generate Liquibase data in the right order?

无人久伴 提交于 2019-12-06 03:40:19
问题 I'm using Liquibase for versioning an existing database, so I'm using liquibase \ --logLevel=debug \ --driver=com.mysql.jdbc.Driver \ --classpath=lib/mysql-connector-java-5.1.30.jar \ --url="jdbc:mysql://127.0.0.1:3306/schema" \ --username=user \ --password=pass \ --diffTypes="data" \ --changeLogFile="./data.xml" generateChangeLog for generating the changeset xml. This works, but the problem is when I'm trying to run those generated changesets. I get Cannot add or update a child row: a

Liquibase not picking up seed data with Spring Boot

試著忘記壹切 提交于 2019-12-06 01:33:15
I am using Spring-Boot 1.2.1, and Liquibase to create both H2 (testing) and PostgreSQL (QA & Production) databases. I have a couple of tables that I want to seed when the db is created. However, despite trying both dataLoad and sqlFile, nothing is getting inserted. My sql file is just a bunch of insert statements such as: INSERT INTO state (Name, Code) VALUES('Alabama','AL'); INSERT INTO state (Name, Code) VALUES('Alaska','AK'); Here is my relevant changelog-master.xml: xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=

Liquibase include with context

送分小仙女□ 提交于 2019-12-05 23:08:01
I need to include files in a databaseChangeLog, but these files may not exist, depending on the installation. My idea was to use something like includes with context, so Liquibase will only try to open the file when the appropriate context is given: <include file=”myFile” context=”myContext”/> But context is not used in an include tag, and Liquibase fails because the file is not present. I’ll rather not use includeAll because I need the files to be included at specific parts of my main file. Any ideas? Thanks! Which version of liquibase are you using? The "context" was added to the include tag

Define Changeset for insert query in liquibase

家住魔仙堡 提交于 2019-12-05 19:44:16
I have two table as following : CREATE TABLE StudentMaster ( sId SERIAL, StudentName VARCHAR(50) ); CREATE TABLE StudentClassMap ( studnetId BIGINT UNSIGNED NOT NULL, studentClass VARCHAR(10), FOREIGN KEY (studnetId) REFERENCES StudentMaster (sId) ); This is my insert query. INSERT INTO StudentMaster (studentName) values ('Jay Parikh'); INSERT INTO StudentClassMap (studnetId, studentClass) values ((SELECT sId from StudentMaster where studentName='Jay Parikh'), 'M.Sc. 1st Year'); I want to define ChangeSet for thes queries in liquibase . For First query ChangeSet will be : <changeSet author=

Liquibase includeAll tag is ignored

馋奶兔 提交于 2019-12-05 16:15:03
Here we go.. We have a Spring Boot 1.4.0 application and we're using Liquibase 3.5.1 for our DB management. All of our individual changeset files are located in /src/main/resources/db/changelog and they have the following naming schema: [semanticVersion]-[descriptor].yml The master changelog, however, is located inside a runtime dependency. db.changelog-master.yaml databaseChangeLog: - changeSet: id: 1.0.1 author: atlassian changes: - createTable: //code omitted for brevity - includeAll: path: classpath*:db/changelog errorIfMissingOrEmpty: false Now to the problem. Running the application

Spring test injection not working when using TestExecutionListener

一曲冷凌霜 提交于 2019-12-05 12:46:51
问题 I want to use a custom TestExecutionListener in combination with SpringJUnit4ClassRunner to run a Liquibase schema setup on my test database. My TestExecutionListener works fine but when I use the annotation on my class the injection of the DAO under test no longer works, at least the instance is null. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/applicationContext-test.xml" }) @TestExecutionListeners({

PostgreSQL Check Constraint in Liquibase

假装没事ソ 提交于 2019-12-05 12:23:32
I am wanting to create a check constraint in Liquibase on a PostgreSQL database table for an integer data type column that follows this logic: int_value >= 0 AND int_value <= 6 What is the proper XML request to make this happen? This should be the way: <column name="int_value" type="INT" > <constraints checkConstraint="CHECK (int_value >= 0 AND int_value <= 6)"/> </column> However, current Liquibase (3.5.1) ignores checkConstraint attribute. There is a pull request , but it is added only to 4.0 milestone. Thus, we have to use the raw sql for check constraints for the time being. This works for

Grails 3 database-migration-plugin initialization error

雨燕双飞 提交于 2019-12-05 11:01:06
I recently added database-migration-plugin to my grails 3.0.11 app. The problem is when I try to run-app I get a following error: ERROR grails.boot.GrailsApp - Application startup failed Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springLiquibase_dataSource': Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: java.lang.IllegalArgumentException: Script text to compile cannot be null! Looks like it can't find changelog.xml in my grails-app/migrations folder. My build.gradle file

Liquibase with multiple schemas

故事扮演 提交于 2019-12-05 10:29:40
I have a software wich uses multiple schemas. I made db.changelog-master.xml to maintain different releases and db.changelog-S16.xml to current sprint (it's currently sprint 16 going on). db.changelog-S16.xml is looking like this: <?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" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> <include file="my_schema_1.xml" relativeToChangelogFile="true" /> <

No inverse to liquibase.change.core.RawSQLChange created

牧云@^-^@ 提交于 2019-12-05 08:06:23
The problem consist in: When play the command maven, the seems problem find in https://liquibase.jira.com/browse/CORE-465 , but is that 2009, can marked with "Cannot Reproduce", i'm use one file .xml type liquibase with one changeSet, but many createTable, addPrimaryKey, rollback, addForeignKeyConstraint, this file create always tables and your respective constraints, but i'm make a rollback this wrong happened, i'm tired find for Internet, then can't found solution for the problem, are you can solved this problem? share with the community! The plugin and command use for a maven at this: