Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

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/

Viewing all articles
Browse latest Browse all 2993

Trending Articles