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

Liquibase is stuck on 'Reading from [dbo].[DATABASECHANGELOG]'

$
0
0
Does anybody have any idea why my Liquibase deployment hangs on 'Reading from [dbo].[DATABASECHANGELOG]' and just sits there infinitely? I even dropped and recreated DATABASECHANGELOG and DATABASECHANGELOGLOCK tables, and I thought it would give me a clean slate, but alas, it's still stuck on that 'reading' step.



Thanks in advance, 
Vlad

Manage multibranch database versioning.

$
0
0
Hi, 

Liquibase works as a charm when our delivery pipeline is straightforward, and we work with a short cycle development. But it is not always the case. 



Firstly let's imagine that we should have several instances of DB in productions at the same time:  Version 5 and 6. All instances of "5" should eventually migrate to '6' but it is not the case so far and will take some months.

Then the bug fix happens, and we should patch both 5 and 6 to some 5.1 and 6.1 versions. This means that the migration 5=>6 is becoming obsolete and risky.

So we have:

 v5: 
\migrate 4 => 5 
+v5.1: 
\patch1 5 => 5.1 
 v6: 
\migrate 5 => 6 
+v6.1: 
\patch1 6 => 6.1  


So by introducing a patch into 2 versions, we've added a gap "5.1=>6". 
We can probably create 5.1=>6 every time we need a patch on older versions but it does not have any sense since "patch1" is valuable, and v6 as we know is worthless without this patch.

What would you recommend for this use case? 

Re : Manage multibranch database versioning.

Re : Manage multibranch database versioning.

$
0
0
As your deployment complexity increases, Datical is a great option. 

From a pure-Liquibase standpoint, it doesn't really know or understand "versions", it just tracks individual changeSets and relies on you to manage what changeSets are in the file using branches in your version control system. So, assuming you have a v5 branch and a v6 branch, you can add your patch1 changeSets into the v5 branch and then cherry-pick them into the v6 brach. 

That way, when you deploy the v5 branch next time, it will apply the v5 changeSets and the patch1 changest and when you do upgrade to the v6 branch, it will see that the patch1 changeSets have been applied and not re-apply them.

Nathan

The Bachelor S21e2

Liquibase + MySQL + Foreign Keys to different database

$
0
0
MySQL has a lovely feature with foreign keys.  In particular one can have a foreign key reference a table in a DIFFERENT database.  Apparently liquibase PUKES on this.  consider the following simple schema:

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`MyDB` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `MyDB`;

DROP TABLE IF EXISTS `Users`;

CREATE TABLE `Users` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `Accounts_id` INT(11) DEFAULT NULL ,
  PRIMARY KEY (`id`),
  KEY `fk_Users_Accounts_idx` (`Accounts_id`),
  CONSTRAINT `fk_Staffs_Accounts` FOREIGN KEY (`Accounts_id`) REFERENCES `AnotherDB`.`Accounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=utf8 ;

If you run liquibase generateChangeLog on this schema, then it will die with the following message:

Unexpected error running Liquibase: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

Obviously my schema is much more complicated than that.  But I have reduced it to this simple problem.

Curiously on my REAL schema, I can make subtle changes to certain other aspects of the schema (e.g. rename a column in some unrelated table).  And the generateChangeLog will work!  Sort of.

Alas if you look at the output changelog file, you will discover all the tables are created with no column definitions added.  It does do other things in the resultant XML - like generated indices....But of course if you try to do something like :changeLogSync - it barfs with a bunch of errors - specifically because the columns are all null.

Any comments/suggestions from others on this bug?

Jim

Re : Liquibase + MySQL + Foreign Keys to different database

$
0
0
Liquibase is really designed to only work with a single schema at a time. If you are working with complex multi-schema databases (or, as MySQL calls them, multiple databases) then you should probably look at Datical DB. The other option is to write your own wrappers around Liquibase to handle the multiple different databases. 

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

Re : Liquibase + MySQL + Foreign Keys to different database

$
0
0
I do tend to see generateChangeLog as a way to bootstrap using liquibase, but not the primary workflow and so there does tend to be more edge-case issues like handling cross-database foreign keys in mysql. The best way long-term to work with Liquibase is to add to the changelog file yourself during development.

However, the generateChangeLog command shouldn't completely die in this case. There is a --schemas parameter that can be used to make Liquibase snapshot both schemas/databases which may help since it will see all the objects. Otherwise, open a but a liquibase.jira.com and I can take a look at it more.

Nathan

Re : Liquibase + MySQL + Foreign Keys to different database

$
0
0
Well Nathan...YOU DA' MAN!

I suspect you didn't exactly mean the --schemas option - I couldn't find such an option.  However, there is the --defaultSchemaName option which DOES solve the problem.

I'm very grateful for you support and help on this issue Nathan

Jim

Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

$
0
0
This is a weird error that I am seeing while running a liquibase script. It seems to happen intermittently but can't get rid of it.

I realized that I was able to get around it by making sure that no active connections to the mysql instance were present.

For example:

Run liquibase script->runs fine
Connect to mysql db from another window using command line or sequel pro 
Run liquibase script from first window ...you see this error.

"Unexpected error running Liquibase: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."

Any ideas on what is the root cause of this?

Liquibase vs SQLPLUS for SPOOL output.

$
0
0
Hello,

I am currently migrate from oracle sqlplus standard usage to liquibase. But during this migration, my '.sql' file have some declaration off spool file and liquibase don't like them:

I did a simple test sql file like

SQL\03.05\57878\pa_ng_123389_BBA_001_rtg_57878.sql

SPOOL my_spool.txt
select sysdate from DUAL;
SPOOL off


without success :(.

Error message
SEVERE 18/01/17 09:11: liquibase: SQL/03.05/57878/afpl_db_changelog_57878.xml::5
7878::rtg: ORA-00900: instruction SQL non valide
 [Failed SQL: SPOOL my_spool.txt
select sysdate from DUAL]
liquibase.exception.MigrationFailedException: Migration failed for change set SQ
L/03.05/57878/afpl_db_changelog_57878.xml::57878::rtg:
     Reason: liquibase.exception.DatabaseException: ORA-00900: instruction SQL n
on valide
 [Failed SQL: SPOOL my_spool.txt
select sysdate from DUAL]
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:619)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:51
)


Some one can help me ?

If spool is not available with liquibase, maybe the option '--logLevel' can help me to have sql execution output ?

My liquibase commande is:
java -jar liquibase.jar \
      --driver=oracle.jdbc.OracleDriver \
      --changeLogFile=SQL/03.05/57878/afpl_db_changelog_57878.xml \
      --url="jdbc:oracle:thin:@plvuatdb01:1522:PLVH03" \
      --classpath=ojdbc6.jar \
      --username=xxx\
      --password=xxx\
       --logLevel=info \
      update

SQL/03.05/57878/afpl_db_changelog_57878.xml
<databaseChangeLog
 
  <changeSet id="57878" author="rtg" dbms="oracle" runAlways="false" failOnError="true" runOnChange="false" context="standard">
    <sqlFile path="SQL\03.05\57878\pa_ng_123389_BBA_001_rtg_57878.sql" stripComments="true" splitStatements="true" />
  </changeSet>

</databaseChangeLog>



Regards,


liquibase creates index then fails cause index exists

$
0
0
I am wrong a Long liquibase script.  when it runs the changeSet to create an index, it does so, then it complains that the index exists, and fails

The changeset is simple:


<changeSet author="ethomps2 (generated)" id="1481645438287-1049">
<preConditions onFail="MARK_RAN">
<not>
<indexExists schemaName="CARSIS" indexName="FK_ADJITEM_IDX_13" />
</not>
</preConditions>
<createIndex schemaName="CARSIS" tablespace="ADJITEM_IND" indexName="FK_ADJITEM_IDX_13"
tableName="ADJITEM">
<column name="ADJPG_NUM" />
</createIndex>
</changeSet>

Any ideas?

Re : Liquibase + MySQL + Foreign Keys to different database

$
0
0
Alas, my zeal was underserved :(.  Yes - it didn't crash - and yes it generated a valid XML file.  Alas, the schema it generated the XML file was for the database referenced in the --defaultSchemaName option - ignoring the one used in the connector

I've created a bug in liquibase.jira.com for this issue.

Jim

Re : Liquibase + MySQL + Foreign Keys to different database

$
0
0
I did find the --schemas option which you referenced in your original response.  There is such an option.  However, its usage is only valid on a diff - not a generate

Jim

cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
Hi, I am trying to get started with liquibase and generated a change log from an existing database and tried to apply this changelog into an empty schema. but it fails with this error.

Not sure where to start, didn't find any solution for this issue....

appreciate any help.

./liquibase --driver=com.mysql.jdbc.Driver --classpath=/deploy/back/deploy/current/lib/mysql-connector-java-5.1.13.jar --changeLogFile=/home/local/CAREZEN/rreddy/liquibase/careuat14.changelog.xml --url="jdbc:mysql://10.192.100.21/test" --username=test --password=test update
Unexpected error running Liquibase: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.

Thanks,
Ramki

Re : cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
Can you attach the changelog (/home/local/CAREZEN/rreddy/liquibase/careuat14.changelog.xmlyou are working with?

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

Re : cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
Hi Steve, Attaching the changelog here...

Re : cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
I took a look and didn't see any obvious errors. I have seen this sort of error when the file is not saved with UTF-8 encoding, but the file I extracted did seem to have UTF-8 encoding. You might be able to get more information by running your command and adding "--logLevel=DEBUG" to get a better idea where in the changelog it is having problems. 

Basically, the error message is saying that liquibase can't even parse the XML from the changelog. The XML parsing is done with a well-known XML parsing library, so the most likely cause is malformed or mal-encoded XML.

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

Re : cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
Thanks Steve, I see more information when running with DEBUG option..

Unexpected error running Liquibase: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.

SEVERE 1/25/17 8:31 PM: liquibase: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.
liquibase.exception.ChangeLogParseException: Error parsing line 2300 column 23 of /home/local/CAREZEN/rreddy/liquibase/careuat14.changelog.xml: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.
        at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114)
        at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17)
        at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229)
        at liquibase.Liquibase.update(Liquibase.java:202)
        at liquibase.Liquibase.update(Liquibase.java:192)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: org.xml.sax.SAXParseException; lineNumber: 2300; columnNumber: 23; cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:458)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3200)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3160)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3062)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2140)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:859)
        at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.scanEndElement(XML11NSDocumentScannerImpl.java:814)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2957)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
        at com.sun.org.apache.xerces.internal.impl.XML11NSDocumentScannerImpl.next(XML11NSDocumentScannerImpl.java:857)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)
        at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:106)
        ... 7 more


 possible values:&#10;

so it didn't like the new line characters in the comments...after removing those...it's complaining of something else...

SEVERE 1/25/17 8:45 PM: liquibase: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.
liquibase.exception.ChangeLogParseException: Error parsing line 1440 column 23 of /home/local/CAREZEN/rreddy/liquibase/careuat14.changelog.xml: cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.
        at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:114)
        at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:17)
        at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:229)
        at liquibase.Liquibase.update(Liquibase.java:202)
        at liquibase.Liquibase.update(Liquibase.java:192)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1130)
        at liquibase.integration.commandline.Main.run(Main.java:188)
        at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1440; columnNumber: 23; cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.


will keep looking....

but yeah DEBUG is somewhat helpful.

Thanks
Ramki

Re : cvc-complex-type.2.3: Element 'createTable' cannot have character [children]

$
0
0
Steve, I am stuck trying to figure out what could be wrong with this line, actually that line doesn't correspond to the exact line number within the file...

Caused by: org.xml.sax.SAXParseException; lineNumber: 1440; columnNumber: 23; cvc-complex-type.2.3: Element 'createTable' cannot have character [children], because the type's content type is element-only.

everything looks fine, I am not seeing any issues with XML around that line...

-Ramki
Viewing all 1169 articles
Browse latest View live


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