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:
- <?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"
- xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
- xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
- http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
- <changeSet id="1" author="test">
- <preConditions onFail="MARK_RAN">
- <not><sequenceExists sequenceName="gen_test" /></not>
- </preConditions>
- <createSequence sequenceName="gen_test" />
- </changeSet>
- <changeSet id="two" author="steve">
- <tagDatabase tag="v_1.0"/>
- </changeSet>
- </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:
- <?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"
- xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
- xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
- http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
- <changeSet id="1" author="test">
- <preConditions onFail="MARK_RAN">
- <not><sequenceExists sequenceName="gen_test" /></not>
- </preConditions>
- <createSequence sequenceName="gen_test" />
- </changeSet>
- <changeSet id="two" author="steve">
- <preConditions onFail="MARK_RAN">
- <not><sequenceExists sequenceName="gen_test" /></not>
- </preConditions>
- <tagDatabase tag="v_1.0"/>
- </changeSet>
- </databaseChangeLog>