liquibase include file and dbDoc Or update fails - migration

I have directory structure for migrations as follow:
db1:
latest/ (triggers,functions,procedures)
tables/
v000/master.xml
update.xml
db1/update.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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-2.0.xsd">
<include file="v000/master.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
db2: (try to include db1/update.xml) schema here , as I need to extend/add to db1 schema )
update.xml
db2/update.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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-2.0.xsd">
<include file="../db1/update.xml" />
</databaseChangeLog>
db1> liquibase --changeLogFile=update.xml update , successful
but
db2 > liquibase --changeLogFile=update.xml validate
show validation errors for tables included from db1/v000/master.xml
<include file="tables/12_createTable_audiences.xml" />
Error Reading Migration File:tables/12_createTable_audiences.xml .....
if I fix the error by following changes (for each table: in db1/v000/mater.xml)
<include file="../tables/12_createTable_audiences.xml" relativeToChangelogFile="true"/>
db2 > liquibase --changeLogFile=update.xml validate/update works fine
but
db2 > liquibase --changeLogFile=update.xml dbDocs ~/docs/db1
fails on table 12_createTable_audiences.xml
Does any one know how to fix these (path issues) ? Why update and dbDoc commands behave differently for same paths ?
thanks for your kind support.

Instead of using relativeToChangelogFile attribute try to specify the path in include file from the root. Something like
<iuclude file = "./Update/db1/update.xml" />

Related

Intellij not recognising xml for bpmn

This just started to happen out of no where. I have an existing Activiti project. I have the Activiti BPMN Visualizer plugin installed. Now in every one of my .bpmn20.xml files, Idea is saying "element x must be declared" or "cannot resolve symbol" Here is an example:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://www.activiti.org/processdef">
<process id="test" name="test" isExecutable="true">
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
the tags for definitions and process are showing red, with errors in the problems tab. The namespaced tags, bpmndi:BPMNDiagram for example, are fine. What has happened and how do I fix it?
If it happens out of nowhere try to invalidate the cache and restart the ide.

Create Joomla Module > warning : JInstaller: :Install: Can't find Joomla XML setup file

I created Joomla Module by following tutorial on joomla website, for the first part it works but after i added 2nd part of tutorial about Creating a simple module/Using the Database it doesn't work.
i got warning
JInstaller: :Install: Can't find Joomla XML setup file.
the 2nd part tutorial is based on 1st tutorial. maybe i've done something wrong in my XML file.
this is my XML file
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1.0" client="site" method="upgrade">
<name>Hello, World 2</name>
<author>Dhany</author>
<version>1.0.0</version>
<description>Belajar Module 2</description>
<files>
<folder>sql</folder>
<filename>mod_helloworld2.xml</filename>
<filename module="mod_helloworld">mod_helloworld2.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<config>
</config>
</extension>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/mysql/updates</schemapath>
</schemas>
</update>
you can download my complete module here
thanks for your help
Remember </extension> should come at the end. Not in between. That should be the ending tag. Your code should looklike this.
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.1.0" client="site" method="upgrade">
<name>Hello, World 2</name>
<author>Dhany</author>
<version>1.0.0</version>
<description>Belajar Module 2</description>
<files>
<folder>sql</folder>
<filename>mod_helloworld2.xml</filename>
<filename module="mod_helloworld">mod_helloworld2.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<config>
</config>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/mysql/updates</schemapath>
</schemas>
</update>
</extension>
Note: I also noted that your updates is a file instead of a folder. Remember it should be a folder.

Why is liquibase trying to recreate the table DATABASECHANGELOG

I created a liquibase.properties as follows
driver: net.snowflake.client.jdbc.SnowflakeDriver
classpath: ./liquibase-snowflake-1.0.jar
url: jdbc:snowflake://....us-east-1.snowflakecomputing.com/?db=...&warehouse=...&schema=LIQUIBASE&role=SYSADMIN
username: ...
password: ...
changeLogFile: mySnowflakeChangeLog.xml
Initially running liquibase while the file mySnowflakeChangeLog.xml did not exist worked up to creating the liquibase tables within the LIQUIBASE schema (which I had to create first).
Now, if I supply a simple changelog file mySnowflakeChangeLog.xml (see below), the update fails when trying to re-create the underlying liquibase table:
"Object 'DATABASECHANGELOG' already exists"
<?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">
<changeSet author="eric" id="changelog-1.0">
<createTable tableName="TablesAndTables">
<column name="COLUMN1" type="TEXT">
<constraints nullable="true" primaryKey="false" unique="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>
Am I missing something? (I suppose I am...)
I had specified a default schema of LIQUIBASE but I had not informed liquibase where to retrieve its tables.
This is done through the parameter liquibaseSchemaName so all I had to do was to add the following line in my liquibase.properties file
liquibaseSchemaName: LIQUIBASE

Liquibase issues with labels and context

We are using LB 3.5. Below is the master changelog
<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.5.xsd">
<!-- v13.0.00 -->
<include context="v13_0_00_03" file="changelog-v13.0.00.03.xml" relativeToChangelogFile="true"/>
<include context="v13_0_00_04" file="changelog-v13.0.00.04.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Now in changelog-v13.0.00.03.xml we have these changeSets:
<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.5.xsd">
<changeSet id="CT-39_1" author="auth1" failOnError="false" runOnChange="false" labels="DDL">
<sqlFile encoding="utf8" endDelimiter="\nGO" path="../scripts/ddl/ddl.sql" relativeToChangelogFile="true" />
</changeSet>
<changeSet id="CT-2" author="auth2" runOnChange="false" labels="TRIGPROC">
<preConditions onFail="CONTINUE">
<changeSetExecuted id="CT-39_1" author="auth1" />
</preConditions>
<sqlFile encoding="utf8" endDelimiter="\nGO" path="../scripts/trigprocs/sp_ins1.sql" relativeToChangelogFile="true"/>
</changeSet>
<changeSet id="CT-18" author="auth3" runOnChange="false" labels="TRIGPROC">
<sqlFile encoding="utf8" endDelimiter="\nGO" path="../scripts/trigprocs/sp_ins2.sql"
relativeToChangelogFile="true"/>
</changeSet>
<changeSet id="CT-2228" author="auth4" runOnChange="false" labels="CONFIG">
<sqlFile encoding="utf8" endDelimiter="\nGO" path="../scripts/config/insert_rec.sql" relativeToChangelogFile="true"/>
</changeSet>
The following command works fine as I expect to see SQL file of v13.0.00.03 and labeled as CONFIG:
liquibase --contexts=v13_0_00_03 --labels=CONFIG updateSQL
But this command won't work
liquibase --contexts=v13_0_00_03 --labels="CONFIG, DDL" updateSQL
It only generates SQL for CONFIG and not DDL. I tried "CONFIG or DDL", no luck.
Another issue is that, if I change the 'labels' attribute in changeSets to 'context', LB doesn't generate anything using --contexts="v13_0_00_03, CONFIG".
Are these bugs or have I missed anything here?
The only possibility that I can think of is that the DDL changes have already been applied. You have the changeset that is labeled DDL as runOnChange=false, so even if the file has changed it will not re-run.

How to add xml file during installation using wix

I want to create the following xml during the installation created by wix 3.9.
<?xml version="1.0" encoding="utf-8"?>
<MappedUsers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UsersList>
<LyncUserID>
<CustomUserName>John.Smith</UcaUserName>
</LyncUcaUserID>
</UsersList>
</MappedUsers>
Tried creating the file using following code but got the error message during installtion that file doesn't exists.
<?define UserNameFile="[AppDataFolder]ThirdParty\LyncUcaUserMapping.XML" ?>
<util:XmlFile Id="UserMapping" Value="[USER_NAME]" ElementPath="/UsersList/LyncUserID/add[\[]#key='UcaUserName'[\]]" Action="setValue" File="$(var.UserNameFile)" Name="value" Sequence="7" />
Since I could not create the file during the installation I created the file manually and placed in my appdata folder. But then above code didn't work either as it says "failed to find the following node".
What am I missing?
Best method to do this is first you copy a sample xml file as below.
<?xml version="1.0" encoding="utf-8"?>
<MappedUsers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
</MappedUsers>
Then edit it using a custom action.
Here is a link which shows how to edit xml files using c#
http://support.microsoft.com/kb/301233
Following link shows how to add custom actions to a wix project.
http://wixtoolset.org/documentation/manual/v3/wixdev/extensions/authoring_custom_actions.html