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

Re : Informix issues

$
0
0
Hi Nathan,

Thank you for taking a look at these issues.
Is there an ETA for when version 3.2.0 might come out?

Thanks.

Release-Version of liquibase-maxdb?

$
0
0
Hi, 

it's been 5 months since the maxdb support was separated from the main module, but it's still an unreleased 1.0.0-SNAPSHOT version.

Are there any plans to release it and to get it into the central maven repo?

Thanks and best regards,
Marc

Re : Release-Version of liquibase-maxdb?

$
0
0
Thanks for reminding me. I am working on improving my test infrastructure and the MaxDB release has fallen by the wayside during that.

I attached an updated snapshot against 3.1.1, are you able to test to make sure it works before I release it? I had to tack a ".txt" extension on to upload it.

Nathan

Re : Using Liquibase to migrate selective data.

Re : Release-Version of liquibase-maxdb?

$
0
0
I haven't quite tested your version, but I've been experimenting around a bit, and MaxDB does not support "call current_schema".  "SELECT CURRENT_SCHEMA FROM DUAL" should do the trick, like:


    @Override
    protected String getConnectionSchemaName() {
        DatabaseConnection connection = getConnection();
        if (connection == null) {
            return null;
        }
        try {
            ResultSet resultSet = ((JdbcConnection) connection).prepareCall("SELECT CURRENT_SCHEMA FROM DUAL").executeQuery();
            resultSet.next();
            return resultSet.getString(1);
        } catch (Exception e) {
            LogFactory.getLogger().info("Error getting default schema", e);
        }
        return null;
    }
 
Marc

Re : Release-Version of liquibase-maxdb?

$
0
0
Seems not enough, though, I get:
  1. Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: liquibase.snapshot.InvalidExampleException: Found multiple catalog/schemas matching null.MY_SCHEMA
  2. at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:209)
  3. at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148)
  4. at liquibase.Liquibase.update(Liquibase.java:189)
  5. at liquibase.Liquibase.update(Liquibase.java:181)
  6. at liquibase.integration.servlet.LiquibaseServletListener.executeUpdate(LiquibaseServletListener.java:220)
  7. at liquibase.integration.servlet.LiquibaseServletListener.contextInitialized(LiquibaseServletListener.java:102)
  8. ... 74 more
  9. Caused by: liquibase.exception.UnexpectedLiquibaseException: liquibase.snapshot.InvalidExampleException: Found multiple catalog/schemas matching null.MY_SCHEMA
  10. at liquibase.snapshot.SnapshotGeneratorFactory.hasDatabaseChangeLogLockTable(SnapshotGeneratorFactory.java:171)
  11. at liquibase.lockservice.StandardLockService.hasDatabaseChangeLogLockTable(StandardLockService.java:134)
  12. at liquibase.lockservice.StandardLockService.init(StandardLockService.java:80)
  13. at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182)
  14. ... 79 more
  15. Caused by: liquibase.snapshot.InvalidExampleException: Found multiple catalog/schemas matching null.MY_SCHEMA
  16. at liquibase.snapshot.jvm.SchemaSnapshotGenerator.snapshotObject(SchemaSnapshotGenerator.java:77)
  17. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:59)
  18. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  19. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  20. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  21. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  22. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  23. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  24. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  25. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  26. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  27. at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:131)
  28. at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:36)
  29. at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:24)
  30. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:129)
  31. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:122)
  32. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:110)
  33. at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:100)
  34. at liquibase.snapshot.SnapshotGeneratorFactory.hasDatabaseChangeLogLockTable(SnapshotGeneratorFactory.java:169)
  35. ... 82 more|

Re : Release-Version of liquibase-maxdb?

$
0
0
adding
     public boolean supportsSchemas() {
        return false;
    }

to MaxDBDatabase seems to do the trick.

Re : Release-Version of liquibase-maxdb?

$
0
0
I committed that change. Otherwise is it working for you?

Nathan

Fluent interface pattern (setter returning 'this') conflicts with JSF

$
0
0
Hello!

I am developing a GUI with JSF to generate DDL for multiple SGBDs.

The problem is that using setter methods returning types, I have some conflicts with EL.

Explaining by example:

When using a simple JSF tag for text input:

<h:inputText value="#{myBackingBean.columnConfig.value}" />

I get below grave warning from EL/JSF validations that doesn't let me submit that form:

Property 'value' not writable on type java.lang.String

Looking ELResolver docs, we have:

PropertyNotWritableException - if the given (base, property) pair is handled by this ELResolver but the specified variable or property is not writable.

Actually I didn't find that ColumnConfig.value isn't writable. Am I confunding something or I got the right path investigating this?

NOTE: I already found a workaround, but it wasn't a clean approach :-|

Re : Enhancing Main.java to help other programs call it.

$
0
0
I've done a pull request agains the master branch. Sorry it took so long, March was a really hectic month.
 
Steve

Re : Release-Version of liquibase-maxdb?

$
0
0
It's not necessary to overwrite getConnectionSchemaName() if supportsSchemas returns true? Nice to know and that part seems to work now. I've just fetched the latest change from github.

Using that latest version I now get 
  1. Caused by: liquibase.exception.LockException: liquibase.exception.UnexpectedLiquibaseException: Don't know how to query for sequences on MYSCHEMA @ jdbc:sapdb://maxdb001:7210/MAX
  2. at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:209)
  3. at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148)
  4. at liquibase.Liquibase.update(Liquibase.java:189)
  5. at liquibase.Liquibase.update(Liquibase.java:181)
  6. at org.nowhere.test.DBServlet.applyTemplate(DBServlet.java:177)
  7. ... 50 more
  8. Caused by: liquibase.exception.UnexpectedLiquibaseException: Don't know how to query for sequences on MYSCHEMA @ jdbc:sapdb://maxdb001:7210/MAX
  9. at liquibase.snapshot.jvm.SequenceSnapshotGenerator.getSelectSequenceSql(SequenceSnapshotGenerator.java:106)
  10. at liquibase.snapshot.jvm.ext.SequenceSnapshotGeneratorHana.getSelectSequenceSql(SequenceSnapshotGeneratorHana.java:22)
  11. at liquibase.snapshot.jvm.SequenceSnapshotGenerator.snapshotObject(SequenceSnapshotGenerator.java:55)
  12. at liquibase.snapshot.jvm.ext.SequenceSnapshotGeneratorHana.snapshot(SequenceSnapshotGeneratorHana.java:35)
  13. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  14. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  15. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  16. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  17. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  18. at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:62)
  19. at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:47)
  20. at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:131)
  21. at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:36)
  22. at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:24)
  23. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:129)
  24. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:122)
  25. at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:110)
  26. at liquibase.snapshot.SnapshotGeneratorFactory.has(SnapshotGeneratorFactory.java:100)
  27. at liquibase.snapshot.SnapshotGeneratorFactory.hasDatabaseChangeLogLockTable(SnapshotGeneratorFactory.java:169)
  28. at liquibase.lockservice.StandardLockService.hasDatabaseChangeLogLockTable(StandardLockService.java:134)
  29. at liquibase.lockservice.StandardLockService.init(StandardLockService.java:80)
  30. at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182)
  31. ... 54 more|

BTW: What I'm testing here: We have ~40 change sets that we used with liquibase 2.0.5. We're trying to upgrade to liquibase 3.x as we need to support HANA as alternative DB. I'm simply trying to run our existing change set to a MaxDB (version 7.8.2.34) with the new liquibase version.

I've tried changing supportSequence() to return false in MaxDBDatabase, and that seems to work, but now I'm running into a strange error where a second instance of the web application tries to recreate the DATABASECHANGELOGLOCK table from StandardLockService.acquireLock and fails with a "Duplicate table name:DATABASECHANGELOGLOCK" error... I'm checking what goes wrong there.

Re : Release-Version of liquibase-maxdb?

$
0
0
OK, I'm stuck. Our primary instance works (with supportSequence() returning false), but I can't get rid of the DATABASECHANGELOGLOCK thing. I've tried to debug a bit into the liquibase coding, but I'm getting lost there.

Scenario: We have two web applications running on a single Tomcat. The first web application has the LiquibaseServletListener configured to keep our DB schema up-to-date. This first web application works fine. The second web application has a javax.sql.DataSource as reference in it's web.xml and call Liquibase programmatically. Both web applications use the same liquibase version, but for some reason the second web app tries to recreate the DATBASECHANGELOGLOCK table when it's called.

Any ideas?

Thanks and best regards,
Marc



setting databaseChangeLog/LockTableName via Maven Plugin

$
0
0
In our project we need to support more than one oracle database schema with liquibase. the idea is to generate only one sql file using liquibase which will be executed as sysdba in oracle.
therefore we need the a schema name to be added to the liquibase databaseChangeLog/lock tables. we use maven to run liquibase 3.0.8

there are many blogs and discussions on how to do this with maven. right now it looks like to only way possible is to pass as command line parameter since maven properties in pom will be ignored
    1. $ mvn clean resources:resources liquibase:updateSQL -Pgenerate-central -Dliquibase.databaseChangeLogLockTableName=ML_FRAMEWORK.databaseChangeLogLock
    unfortunately this creates an invalid create table statement for oracle
    1. CREATE TABLE ML_FRAMEWORK.databaseChangeLogLock (ID NUMBER(10) NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR2(255), CONSTRAINT PK_ML_FRAMEWORK.DATABASECHANGE PRIMARY KEY (ID));
    if these tables already exist, liquibase though includes create table statements in the output sql file
    1. -- Liquibase version: 3.1.1
    2. -- *********************************************************************

    3. SET DEFINE OFF;

    4. -- Create Database Lock Table
    5. CREATE TABLE ML_FRAMEWORK.databaseChangeLogLock (ID NUMBER(10) NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR2(255), CONSTRAINT PK_ML_FRAMEWORK.DATABASECHANGE PRIMARY KEY (ID));

    6. -- Initialize Database Lock Table
    7. DELETE FROM ML_FRAMEWORK.databaseChangeLogLock;

    8. INSERT INTO ML_FRAMEWORK.databaseChangeLogLock (ID, LOCKED) VALUES (1, 0);

    9. -- Lock Database
    10. -- Create Database Change Log Table
    11. CREATE TABLE ML_FRAMEWORK.databaseChangeLog (ID VARCHAR2(255) NOT NULL, AUTHOR VARCHAR2(255) NOT NULL, FILENAME VARCHAR2(255) NOT NULL, DATEEXECUTED TIMESTAMP NOT NULL, ORDEREXECUTED NUMBER(10) NOT NULL, EXECTYPE VARCHAR2(10) NOT NULL, MD5SUM VARCHAR2(35), DESCRIPTION VARCHAR2(255), COMMENTS VARCHAR2(255), TAG VARCHAR2(255), LIQUIBASE VARCHAR2(20));

    12. -- Create Database Lock Table
    13. CREATE TABLE ML_FRAMEWORK.databaseChangeLogLock (ID NUMBER(10) NOT NULL, LOCKED NUMBER(1) NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR2(255), CONSTRAINT PK_ML_FRAMEWORK.DATABASECHANGE PRIMARY KEY (ID));

    however using liquibase 2.0.1 we can set these properties as systemvariables using maven surefire plugin. liquibase will then use these properties for the table names
    1. <plugin>
    2. <groupId>org.liquibase</groupId>
    3. <artifactId>liquibase-maven-plugin</artifactId>
    4. <configuration>
    5. <propertyFile>src/main/resources/configuration/dev/liquibase.properties</propertyFile>
    6. </configuration>
    7. <executions>
    8. <execution>
    9. <phase>process-resources</phase>
    10. <configuration>
    11.     
    12. <systemPropertyVariables>
    13. <liquibase.databaseChangeLogLockTableName>${liquibase.databaseChangeLogLockTableName}</liquibase.databaseChangeLogLockTableName>
    14. <liquibase.databaseChangeLogTableName>${liquibase.databaseChangeLogTableName}</liquibase.databaseChangeLogTableName>
    15. </systemPropertyVariables>
    16. </configuration>
    17. <goals>
    18. <goal>update</goal>
    19. <goal>updateSQL</goal>
    20. </goals>
    21. </execution>
    22. </executions>
    23. </plugin>

    unfortunately liquibase 2.0.1 is not an option for us. Is there anyway to have the properties set in pom for liquibase 3.0.8 or should i file a bug?

    Issues migrating from Liquibase 2.0 to 3.1

    $
    0
    0
    Hellow Friends,
     
    we are in the process of migrating from liquibase 2.0 to 3.1. our installer is giving attached exception when we try to upgrade it. any help in this regard is deeply appreciated.
     
     
    thanks!
     

    Re : Issues migrating from Liquibase 2.0 to 3.1

    $
    0
    0
    Your attachment doesn't seem to be here.

    Making add/dropColumn and create/dropTable more defensive

    $
    0
    0
    Sometimes we have the problem that the database was changed outside of liquibase. In that case,
    the updates could not be applied, the changes or part of the change had already been applied.

    While it's certainly worth to investigate, how/why the database schema was changed without letting
    liquibase control that change, there are (at least for MySQL) some options to make the changes more defensive:

    An "ALTER TABLE D.A ADD COLUM b VARCHAR(10)" could be wrapped for MySQL into an if condition like this

    SELECT COUNT(*) into @exist FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'D' AND TABLE_NAME = 'A' AND COLUMN_NAME = 'b';
    set @query = IF(@exist <= 0, 'ALTER TABLE D.A ADD COLUMN b VARCHAR(10)', 'Select \'Column already exists\'');
    prepare stmt from @query;
    EXECUTE stmt;

    The check should of course be extended to also verify the column type.

    The same can be done with CREATE TABLE and DROP TABLE changes. Create table would drop the table before (if exists):

    DROP TABLE IF EXISTS A;
    CREATE TABLE A (C VARCHAR(10));

    A drop table would simply have the "IF EXISTS".

    That way, the database update would not fail, if the same change has been already applied without using liquibase. The resulting schema should be the same, the changeset should be marked as executed.

    Do you think, this would be a useful improvement to be integrated into liquibase?

    Regards,
    Andreas

    Re : int array type for HQSLDB

    $
    0
    0
    You could just use a <sql> block and write the add column statement inside.

    Re : Memory consumption for large files

    $
    0
    0
    I'm running into a very similar situation. One of the liquibase files is large (initializes a database to a certain release level). We run liquibase from the command line with 256 MB of heap and it will error out with an OutOfMemory exception. We're using the latest 3.1.1 version. The JIRA referenced above appears to have been pulled into the 3.0.7 snapshot. Is it in 3.1.1?

    Are there any known, unresolved memory issues with version 3.1.1?

    Thank you.

    Re : int array type for HQSLDB

    $
    0
    0
    Hi there,
    Yes, that would be a solution. i could write the entire create table that way.
    thanks for the suggestion!

    Cheers,
    Stan.

    Slow query performance on Oracle using ALL_TABLES and ALL_TAB_COMMENTS

    $
    0
    0
    I'm experiencing slow Liquibase updates on Oracle with a change log containing 800+ change sets in it.  On MySQL and PostgreSQL, these changes sets run in under ten minutes.  However on Oracle it's taking a little over 20 minutes on a new schema.  I have a one-time per database scenario where I would run this change log on an existing schema with over 1500 tables.  In that scenario, it took more than 12 hours to run.

    Looking at Top Activity in OEM, this (hand-typed) query is consistently the long pole in the tent:
    1. SELECT null as TABLE_CAT, a.OWNER as TABLE_SCHEM, a.TABLE_NAME as TABLE_NAME, 'TABLE' as TABLE_TYPE, c.COMMENTS as REMARKS
    2. from ALL_TABLES a join ALL_TAB_COMMENTS c on a.TABLE_NAME = c.table_name and a.owner = c.owner
    3. WHERE a.OWNER = '<username>' AND a.TABLE_NAME not in
    4. (select mv.name from all_registered_mviews mv where mvn.owner = '<username>')
    The explain plan for this query is quite large.  If I change it to select "count(*)", it takes between 30 and 60 seconds to run and returns 1892 results.  

    I'm not sure under what circumstances Liquibase performs this query but the inclusion of ALL_TAB_COMMENTS seemed unnecessary to me in most cases so I removed that from the query and it reduced the count(*) time to less than a second.  I don't know why Liquibase needs the comments other than generateChangeLog and dbDoc .

    I'm using Liquibase 3.1.1 and Oracle 11.2.0.3 on RHEL 6 with 16 cores, 96 GB of RAM and a RAID-5 storage tray.  The Oracle database has many schemas for different configurations and developers.

    Has anyone else experienced problems with a query like this?
    Viewing all 2993 articles
    Browse latest View live


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