Quantcast
Channel: Liquibase Forums
Viewing all 1169 articles
Browse latest View live

Jenkins Liquibase Runner Plugin

$
0
0
I thought the liquibase community might like to know that I've just released the Jenkins Liquibase Runner Plugin (wiki page).  It provides a builder that evaluates a changelog, and presents details about executed changesets with each build.

I'd be interested in hearing any feedback, either here or, better yet, in JIRA.  Specifically, I'd like to hear what sort of features to add in the future (though, to be sure, you may experience a bug or two I'd want brought to my attention!).

Enjoy.

~kc

 

Re : Error: changeSet -> preConditions and tagDatabase

$
0
0
It appears that liquibase is saying there is an XML syntax error in your changelog. It says the error is on line 17, but it doesn't look like your changelog is 17 lines long. 


Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Re : Error: changeSet -> preConditions and tagDatabase

$
0
0
Sorry, the error message was another file.
Now, correct trace ...


INFO 10/03/16 15:15: liquibase: Successfully released change log lock Unexpected error running Liquibase: Error parsing line 15 column 51 of schema/sgrusr01_seq.xml: cvc-complex-type.2.4.a: Foi detectado um conteúdo inválido começando com o elemento 'createSequence'. Era esperado um dos '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}'. SEVERE 10/03/16 15:15: liquibase: Error parsing line 15 column 51 of schema/sgrusr01_seq.xml: cvc-complex-type.2.4.a: Foi detectado um conteúdo inválido começando com o elemento 'createSequence'. Era esperado um dos '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}'. liquibase.exception.ChangeLogParseException: liquibase.exception.SetupException: Error parsing line 15 column 51 of schema/sgrusr01_seq.xml: cvc-complex-type.2.4.a: Foi detectado um conteúdo inválido começando com o elemento 'createSequence'. Era esperado um dos '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}'. at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:27) at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:227) at liquibase.Liquibase.update(Liquibase.java:202) at liquibase.Liquibase.update(Liquibase.java:192) at liquibase.integration.commandline.Main.doMigration(Main.java:1096) at liquibase.integration.commandline.Main.run(Main.java:180) at liquibase.integration.commandline.Main.main(Main.java:99) Caused by: liquibase.exception.SetupException: Error parsing line 15 column 51 of schema/sgrusr01_seq.xml: cvc-complex-type.2.4.a: Foi detectado um conteúdo inválido começando com o elemento 'createSequence'. Era esperado um dos '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}'. at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:269) at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:230) at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:25) ... 6 more

Re : Error: changeSet -> preConditions and tagDatabase

Re : Error: changeSet -> preConditions and tagDatabase

$
0
0
The file is in the first post ...

Re : Error: changeSet -> preConditions and tagDatabase

$
0
0
OK. So google translate says that this message:

"Foi detectado um conteúdo inválido começando com o elemento 'createSequence'. Era esperado um dos '{"http://www.liquibase.org/xml/ns/dbchangelog":modifySql}'"?
means this:
It detected an invalid content starting with 'createSequence' element. It was expected of the '{'} http://www.liquibase.org/xml/ns/dbchangelog":modifySql
So we need to figure out what that really means.

Liquibase uses a DTD (Document Type Definition) file that specifies what is allowed in a changelog file. Here is a link to the latest DTD:

When I put your file into the Datical DB XML editor, I do get the same syntax error. It appears that the DTD does not allow for a changeset to have the three things you want to have all together.

You can do something similar by using any XML-aware editor and specifying the DTD. I cannot recommend or advise you on the use of any particular XML editor - there are many available.

I was able to do this:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <databaseChangeLog
  3.         xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  4.         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5.         xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  6.         xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
  7.         http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
  8.     
  9.     <changeSet id="1" author="test">
  10.         <preConditions onFail="MARK_RAN">
  11.             <not><sequenceExists sequenceName="gen_test" /></not>
  12.         </preConditions>
  13.         <createSequence sequenceName="gen_test" />
  14.     </changeSet>

  15.     <changeSet id="two" author="steve">
  16.        <tagDatabase tag="v_1.0"/>
  17.     </changeSet>
  18. </databaseChangeLog>
I was also able to create a changeset that had preConditions and tagDatabase elements.
For some reason, the Liquibase DTD will not allow a changeset with preconditions. a tag, and a change (like createSequence) at the same time. I do not know if this was a design decision or a bug. 

One workaround would be to have your changelog look like this:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <databaseChangeLog
  3.         xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  4.         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5.         xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
  6.         xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
  7.         http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
  8.     
  9.     <changeSet id="1" author="test">
  10.         <preConditions onFail="MARK_RAN">
  11.             <not><sequenceExists sequenceName="gen_test" /></not>
  12.         </preConditions>
  13.         <createSequence sequenceName="gen_test" />
  14.     </changeSet>

  15.     <changeSet id="two" author="steve">
  16.         <preConditions onFail="MARK_RAN">
  17.             <not><sequenceExists sequenceName="gen_test" /></not>
  18.         </preConditions>
  19.        <tagDatabase tag="v_1.0"/>
  20.     </changeSet>
  21. </databaseChangeLog>
 
Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

How to get oracle session parameters to apply to all changesets.

$
0
0
We have the need to set an oracle session parameter whenever we run ddl updates.  We have 2 databases where the data is replicated and have different character sets defined but we have to run our ddl with matching character sets, or the data replication breaks.

I added a changeset that always runs first, with the alter session command,   at first this seemed to work but we still have issues from time to time so I am assuming the session is getting reset at some point.

Is there a way to have this alter session run for every for every changeset (without specifically adding it to each one), or a way to keep the session alive for all changeset's, so the parameter stays active?

Thanks,
Scott

Re : Firebird remarks

$
0
0
Unfortunately support for remarks is currently a bit hit and miss. The fix should make it into 4.0, but for now you'll have to use <sql> tags.

Nathan

Re : Jenkins Liquibase Runner Plugin

$
0
0
Very cool. Thanks for building it. 

Let me know if there there are any liquibase bugs you run into or features that would help you out.

Nathan

Re : Notification when liquidbase executes insert

$
0
0
There are few listener-style APIs in liquibase. The main one you would probably be interested in is liquibase.changelog.visitor.ChangeExecListener. You can set that on the liquibase.Liquibase object or other ways, depending on how you are interacting with Liquibase.

Nathan

Re : Rollback runs if precondition fails

$
0
0
I just ran into this issue.   I'm trying to make my change sets work for both MySQL and Postgres.  The updates work great, but on rollback it tries to run the MySQL rollbacks which fail because the syntax isn't correct.

Note:  Pre-conditions are set to MARK_RAN

colon in changeset id in sql format

$
0
0
Hi all,

I' m wondering is it there a possibility to use colon in id attribute while using sql changeset format

i.e. I want to have id like id01:02 

But it seems than sql changelog parser interprets the last colon (not the first) as delimiter between author and id

so:

--changeset dmitry:id01:02

would have outcome
id = id02
author = dmitry:id02

May there is an escape characters for this case? 

Re : colon in changeset id in sql format

$
0
0
There isn't currently an escape character, unfortunately. You can't have a colon in the id

Nathan

Re : Rollback runs if precondition fails

$
0
0
What version of liquibase are you running?

Nathan

Load Data from CSV where one column value is derived from a sql

$
0
0
Hi,
I am trying to load data from csv file.
One of my insert columns value  with type as NUMBER  maxValue is the result of the sql 'select max( id) from myTable'.

All the other values are picked up from the csv file.

How can I do that in liquibase ?

Any help is appreciated.
Thanks



org.hibernate.dialect.Dialect not found

$
0
0
I am using hibernate-core-4.2.7.SP1-redhat-3.jar for Hibernate.  When I run Liquibase diffDatabaseToChangeLog from ant I get the warnings below.  I tried Liquibase jars liquibase-hibernate4.2-3.5.jar and liquibase-hibernate4-3.5.jar.  Neither works.  I looked up org.hibernate.dialect.Dialect and it hasn't been in hibernate jars for a while.  Is there a different hibernate integration jar that will work?

diff-against-hibernate:
[liquibase:diffDatabaseToChangeLog] Starting Liquibase.
[liquibase:diffDatabaseToChangeLog] WARNING 3/21/16 4:59 PM: liquibase: Can not use class liquibase.ext.hibernate.database.HibernateSpringDatabase as a Liquibase service because org.hibernate.dialect.Dialect is not in the classpath
[liquibase:diffDatabaseToChangeLog] WARNING 3/21/16 4:59 PM: liquibase: Can not use class liquibase.ext.hibernate.database.HibernateClassicDatabase as a Liquibase service because org.hibernate.dialect.Dialect is not in the classpath
[liquibase:diffDatabaseToChangeLog] WARNING 3/21/16 4:59 PM: liquibase: Can not use class liquibase.ext.hibernate.database.HibernateEjb3Database as a Liquibase service because org.hibernate.dialect.Dialect is not in the classpath

Validate only with Spring integration

$
0
0
When we use hibernate in production we specify "validate" as the DDL command, so that if we deploy an app it will check that the database is in the expected state, and if it isn't, then it'll throw an exception and stop the application startup. Then the sysadmin can look into what changes need to be applied.

We'd like to do the same thing with Liquibase, and using the Spring integration seems to be the obvious place to do it, but I can not find any reference to this kind of functionality. Does it exist, and if not, is there a method that would return a flag to say if changes are required?

Thanks

Integration with Dropwizard and JUnit

$
0
0
Hi
I've been asking on stackoverflow, but there's no response (here)
I want to automatize my DAO tests, so I want to use the liquibase schema to create a tables for me. Also, as I didn't see the other way, I want it to import some initial data from CSV file. Here's code :

migrations.xml

<loadData tableName="flashcards" file="initialData/flashcards.csv">
            <column name="id" type="COMPUTED" />
            <column name="question" type="STRING" />
            <column name="answer" type="STRING" />
            <column name="deckId" type="COMPUTED" />
</loadData>
flashcards.csv

            id,question,answer,deckId             6ab90e8c-3f28-46b2-81f3-b668f6908c09, testQuestion1, testAnswer1, c6c4d451-65dd-4ac0-9e53-974397c7bea7             a2670d1a-b8fe-4884-ba49-24f5d9458a12, testQuestion2, testAnswer2, c6c4d451-65dd-4ac0-9e53-974397c7bea7             3d55ce90-e2c6-4c0e-b94d-879f1194356c, testQuestion3, testAnswer3, c6c4d451-65dd-4ac0-9e53-974397c7bea7             3a581ad7-ac65-4a49-9697-9d111b3635a7, testQuestion4, testAnswer4, 3809da97-3fe2-4f13-bbc8-1442ea62d719             fc6583eb-99be-4f39-8de6-47fff909431e, testQuestion5, testAnswer5, 3809da97-3fe2-4f13-bbc8-1442ea62d719

Error

Syntax error in SQL statement "INSERT INTO PUBLIC.FLASHCARDS (ID, QUESTION, ANSWER, DECKID) VALUES (6AB90E8C[*]-3F28-46B2-81F3-B668F6908C09, ' testQuestion1', ' testAnswer1', C6C4D451-65DD-4AC0-9E53-974397C7BEA7) ";

expected "[, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )";

SQL statement: INSERT INTO PUBLIC.flashcards (id, question, answer, deckId) VALUES (6ab90e8c-3f28-46b2-81f3-b668f6908c09, ' testQuestion1', ' testAnswer1', c6c4d451-65dd-4ac0-9e53-974397c7bea7) [42001-190] [Failed SQL:

INSERT INTO PUBLIC.flashcards (id, question, answer, deckId) VALUES (6ab90e8c-3f28-46b2-81f3-b668f6908c09, ' testQuestion1', ' testAnswer1', c6c4d451-65dd-4ac0-9e53-974397c7bea7)]

liquibase.exception.DatabaseException: Syntax error in SQL statement "INSERT INTO PUBLIC.FLASHCARDS (ID, QUESTION, ANSWER, DECKID) VALUES (6AB90E8C[*]-3F28-46B2-81F3-B668F6908C09, ' testQuestion1', ' testAnswer1', C6C4D451-65DD-4AC0-9E53-974397C7BEA7) ";

expected "[, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )";

SQL statement: INSERT INTO PUBLIC.flashcards (id, question, answer, deckId) VALUES (6ab90e8c-3f28-46b2-81f3-b668f6908c09, ' testQuestion1', ' testAnswer1', c6c4d451-65dd-4ac0-9e53-974397c7bea7) [42001-190]

[Failed SQL: INSERT INTO PUBLIC.flashcards (id, question, answer, deckId) VALUES (6ab90e8c-3f28-46b2-81f3-b668f6908c09, ' testQuestion1', ' testAnswer1', c6c4d451-65dd-4ac0-9e53-974397c7bea7)]

How can I properly use Liquibase with JUnit and Dropwizard?

Re : Validate only with Spring integration

Re : Integration with Dropwizard and JUnit

Viewing all 1169 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>