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

Error reading properties from liquibase.properties

$
0
0
I ran into an error:
  1. [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.1:update (default-cli) on project bel-domain: Error setting up or running Liquibase: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: FATAL: role "postgres " does not exist -> [Help 1]
I've been following the steps on the page Maven Liquibase Plugin of the documentation.
When I put the database parameters in the configuration of the Liquibase plugin everything works fine. But when I use a properties file with the same parameters and use filtering I get this error as above.

Re : Error reading properties from liquibase.properties

$
0
0
Found the cause of my error!
Somehow there was a space after my property
  1. url: ${db.connectionURL} 
  2. username: ${db.username} 
  3. password: ${db.password} 

When I removed all spaces everything works!

Null Pointer Exception when trying to acquire lock

$
0
0
I get the following error from time to time when migrationg a local postgresql database, but the error occurs much more frequently when connecting via a network to the postgres database running on a small embedded platform (e.g. raspberry pi).
 
I have tried both liquibase 3.1.1 and also 3.1.2-SNAPSHOT.
 
Caused by: liquibase.exception.LockException: java.lang.NullPointerException
        at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:209)         at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148)         at liquibase.Liquibase.update(Liquibase.java:189) 
        at liquibase.Liquibase.update(Liquibase.java:181) 
        at com.vaisala.jx.database.DatabaseMigrator.migrate(DatabaseMigrator.java:100) 
        ... 4 common frames omitted
Caused by: java.lang.NullPointerException: null
        at liquibase.sqlgenerator.core.CreateTableGenerator.generateSql(CreateTableGenerator.java:106) 
        at liquibase.sqlgenerator.core.CreateTableGenerator.generateSql(CreateTableGenerator.java:27) 
        at liquibase.sqlgenerator.SqlGeneratorChain.generateSql(SqlGeneratorChain.java:30) 
        at liquibase.sqlgenerator.SqlGeneratorFactory.generateSql(SqlGeneratorFactory.java:198) 
        at liquibase.sqlgenerator.core.CreateDatabaseChangeLogLockTableGenerator.generateSql(CreateDatabaseChangeLogLockTableGenerator.java:36) 
        at liquibase.sqlgenerator.core.CreateDatabaseChangeLogLockTableGenerator.generateSql(CreateDatabaseChangeLogLockTableGenerator.java:19) 
        at liquibase.sqlgenerator.SqlGeneratorChain.generateSql(SqlGeneratorChain.java:30) 
        at liquibase.sqlgenerator.SqlGeneratorFactory.generateSql(SqlGeneratorFactory.java:198) 
        at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:22) 
        at liquibase.executor.jvm.JdbcExecutor.access$500(JdbcExecutor.java:35) 
        at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:284) 
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54) 
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:106)
        at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:96) 
        at liquibase.lockservice.StandardLockService.init(StandardLockService.java:83) 
        at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182) 
        ... 8 common frames omitted
 
 
Interestingly, if I run the code in debug mode, stepping throught the problematic statemets, it seems to work fine, perhaps suggetsing a timing problem?
 
I added a couple of additional log comments around the problem area (CreateTableGenerator.java, lines ~62)
 
        System.out.println("map of statement types " + statement.getColumnTypes().toString());       
        while (columnIterator.hasNext()) {
            String column = columnIterator.next();
            DatabaseDataType columnType = statement.getColumnTypes().get(column).toDatabaseDataType(database);
            System.out.println("column " + column + " columnType " + columnType);
and got this output:
map of statement types {LOCKGRANTED=datetime, LOCKED=boolean, LOCKEDBY=varchar(255), ID=int}
column ID columnType INT
column LOCKED columnType null
... NPE ..
 
i.e. the LOCKED columnType is boolean in the map, but null when converted to databaseDataType, which implies that under some circumstances the toDatabaseDataType method returns null:
 
    public DatabaseDataType toDatabaseDataType(Database database) {
        DatabaseDataType type = new DatabaseDataType(name.toUpperCase(), getParameters());
        type.addAdditionalInformation(additionalInformation);
        return type;
    }
note that this method doesn't appear to use the database parameter.
 
Have to admit that at this point I am confused, especially as the code works as you would expect when single-stepping through in debug mode. Any help much appreciated ;-)
 
 
 

Re : setting databaseChangeLog/LockTableName via Maven Plugin

$
0
0
hi nathan,
yes I tried using changelogSchemaName but without any success.

I also figured out that there may be a difference between using pom properties or including a properties file. I was trying to set migrationSqlOutputFile what was only possible via pom properties to me.


I still need to use the command line in 3.1.1 to add the the schemaName and I'm still getting the issue with the wrong concatenated primary key.

  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));

Re : Error reading properties from liquibase.properties

$
0
0
Thanks for the followup. I'll see if I can add some better error handling and messages.

Nathan

Re : How to use onSqlOutput in formatted sql mode

$
0
0
Hi Nathan

With onUpdateSql:TEST it works now as expected :-)

Thx,
Mike

Re : Issues migrating from Liquibase 2.0 to 3.1

$
0
0
Any response to this question is greatly appreciated

Re : Issues migrating from Liquibase 2.0 to 3.1

$
0
0
Do you know what command line the installer is using? 

Also, what is the full classpath?

The problem seems to start at the liquibase main command line, and then somewhere along the line it seems to be attempting to load classes that don't exist in the new version. 

Re : Exception: Unknown Liquibase extension

$
0
0
Hello,

sorry for my late response. But it's still not possible for me to make it work. I attached the example that I'm not able to make it work:
  • liqui_test.zip: The refactoring file and the properties file I used
    • located original in d:\tmp
  • ext_test.jar: The jar-file I added to the 3.1.1-liquibase installation lib-path
    • located original in d:\tmp\liquibase-3.1.1-bin\lib
  • LiquibaseTestExtenstion.zip: Export of the eclipse project including the test extension.

I started all with the following command line expression:

D:\tmp\liqui_test>D:\tmp\liquibase-3.1.1-bin\liquibase.bat --changeLogFile=.\EV_Test.xml update

and got still the uknown Liquibase extension exception.

So adding the extension to the classpath (see liquibase.properties) and starting it with the batchscript couldn't solve the problem.

Maybe you have any idea what have to be changed.

Thanks in advance

Regards,

Holger



H2 Remark support for columns and tables.

$
0
0
Hello,

I stumbled across a lack of support for remarks (comments) when dealing with H2 databases.  H2 supports the SQL standard COMMENT ON... syntax.  I had a look in the source code and it seemed like low hanging fruit, so I sucessfully applied the following patch:
  1. ---
  2.  .../java/liquibase/sqlgenerator/core/SetColumnRemarksGenerator.java   | 4 +++-
  3.  .../java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java    | 3 ++-
  4.  2 files changed, 5 insertions(+), 2 deletions(-)

  5. diff --git a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGenerator.java b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGenerator.java
  6. index ec76acf..3661150 100644
  7. --- a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGenerator.java
  8. +++ b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetColumnRemarksGenerator.java
  9. @@ -4,6 +4,7 @@ import liquibase.database.Database;
  10.  import liquibase.database.core.DB2Database;
  11.  import liquibase.database.core.OracleDatabase;
  12.  import liquibase.database.core.PostgresDatabase;
  13. +import liquibase.database.core.H2Database;
  14.  import liquibase.exception.ValidationErrors;
  15.  import liquibase.sql.Sql;
  16.  import liquibase.sql.UnparsedSql;
  17. @@ -20,7 +21,8 @@ public class SetColumnRemarksGenerator extends AbstractSqlGenerator<SetColumnRem
  18.  
  19.   @Override
  20.   public boolean supports(SetColumnRemarksStatement statement, Database database) {
  21. - return database instanceof OracleDatabase || database instanceof PostgresDatabase || database instanceof DB2Database;
  22. + return database instanceof OracleDatabase || database instanceof PostgresDatabase || database instanceof DB2Database
  23. +        || database instanceof H2Database;
  24.   }
  25.  
  26.   @Override
  27. diff --git a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java
  28. index a4bf263..dfc6e20 100644
  29. --- a/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java
  30. +++ b/liquibase-core/src/main/java/liquibase/sqlgenerator/core/SetTableRemarksGenerator.java
  31. @@ -5,6 +5,7 @@ import liquibase.database.core.DB2Database;
  32.  import liquibase.database.core.MySQLDatabase;
  33.  import liquibase.database.core.OracleDatabase;
  34.  import liquibase.database.core.PostgresDatabase;
  35. +import liquibase.database.core.H2Database;
  36.  import liquibase.exception.ValidationErrors;
  37.  import liquibase.sql.Sql;
  38.  import liquibase.sql.UnparsedSql;
  39. @@ -18,7 +19,7 @@ public class SetTableRemarksGenerator extends AbstractSqlGenerator<SetTableRemar
  40.   @Override
  41.   public boolean supports(SetTableRemarksStatement statement, Database database) {
  42.   return database instanceof MySQLDatabase || database instanceof OracleDatabase || database instanceof PostgresDatabase
  43. - || database instanceof DB2Database;
  44. + || database instanceof DB2Database || database instanceof H2Database;
  45.   }
  46.  
  47.   @Override
  48. -- 
... that seemed to do the trick for me.  I don't really have the time to figure out what side effects this might have, nor did I write any tests.  If the change is not problematic, I would be thankful if it made its way into a future release so I can avoid using my fork.

Thanks, 
Sam 

New Extension: Liquibase Spatial

$
0
0
I would like to announce a new extension called Liquibase Spatial.  It adds the ability to handle spatial indexes and geometry types in Derby, H2, MySQL, PostgreSQL and Oracle.

A brief overview is available on the extensions portal: https://liquibase.jira.com/wiki/display/CONTRIB/Spatial+Extension

The project page is on GitHub: https://github.com/lonnyj/liquibase-spatial

I've been using it at work and it has functioned well for me and helped me eliminate some database-specific configuration.  Hopefully someone will find it handy for them as well.

Enjoy,

Lonny

Non-existing referenced sql files doesn't report error

$
0
0
Hi all
I have a project where I want to load some test data using the sqlFile tag.
I use the relativeToChangelogFile="true" property on the tag.
On some occassions I mistyped the path to the file. But this didn't report as an error.
Example:
  <changeSet id="s-notfound-0001" author="karchr"
    runOnChange="true">
     <sqlFile relativeToChangelogFile="true" encoding="UTF-8"
       path="notexisting.sql" />
    <rollback>
    </rollback>
  </changeSet>

Am I doing it wrong?
Is this a feature?
Is it a bug?

Attaching a small project reproducing the behaviour.

Liquibase version 3.1.1, running on Win8.

Regards,
Christian

SQL Server example

$
0
0
Hi, I am new to liquibase and helping my release team integrated this tool. Has anyone got an end example of liquibase for sql server? Like simple steps to create a table or insert statement ?

Thanks

Re : SQL Server example

$
0
0
Do this: run Liquibase generateChangelog on an existing SQL Server database. This will generate examples for you based on your own database. It's pretty neat!

The cool thing about Liquibase is that it is platform agnostic. So, any examples at liquibase.org should be applicable to SQL Server.

Robert

Re : SQL Server example

$
0
0
Hi Robert,
Thank you for your reply. But would I generate a change log for the existing database ?
Brijesh

when I am run this 

java -jar  liquibase.jar
--driver: com.microsoft.sqlserver.jdbc.SQLServerDriver 
--classpath=sqljdbc4.jar 
--url=jdbc:sqlserver://sql-test:1433;tempdb 
--username=test 
--password=test 
--changeLogFile=D:\scripts\test.xml

i fails 

Re : SQL Server example

$
0
0
What error are you getting and what version of liquibase are you using?

Nathan

Re : SQL Server example

$
0
0
Hi Nathan,

I have created a liquibase.properties file and stored above properties in the same location as the Jar file and

properties file 
--driver: com.microsoft.sqlserver.jdbc.SQLServerDriver 
--classpath=D:\Liquibase\microsoft_sqlserver_databasesqljdbc4.jar 
--url=jdbc:sqlserver://sql-test:1433;tempdb 
--username=test 
--password=test 
--changeLogFile=D:\scripts\test.xml

with a changelog

<?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

    <changeSet id="1" author="bob">
        <createTable tableName="TAXI" remarks="This is my super test">
            <column name="ID" type="BIGINT" autoIncrement="true">
                <constraints primaryKey="true"/> 
            </column>
            <column name="LASTNAME" type="VARCHAR(255)" remarks="the name of the test" />
            <column name="FIRSTNAME" type="VARCHAR(255)" remarks="the first name"/>
            <column name="FOREIGN_KEY_ID" type="BIGINT" remarks="reference to some other table"/>
        </createTable>
    </changeSet>

</databaseChangeLog>

 try to run below command.

D:\Liquibase>java -jar  liquibase.jar
Unexpected error running Liquibase: Unknown parameter: '--classpath'
SEVERE 4/25/14 1:32 PM:liquibase: Unexpected error running Liquibase: Unknown parameter: '--classpath'
liquibase.exception.CommandLineParsingException: Unknown parameter: '--classpath'
        at liquibase.integration.commandline.Main.parsePropertiesFile(Main.java:390)
        at liquibase.integration.commandline.Main.main(Main.java:121)

One strange thing I noticed is "sqljdbc4" dose not come with standard sql server installation it is Oracle agent. So is Oracle client a pre requirement for SQL Server ?

Thanks,
Brijesh

Re : SQL Server example

$
0
0
Hi Nathan,

1. Am I using the right class file ?
2. Am I doing the right steps ?

I am using the latest version of the Liquibase. 

Thanks again,
Brijesh

Why DateType in SQL Server 2008 is converted as SMALLDATETIME?

$
0
0
Hello

I had an issue when generating a statement in SQL Server 2008 database with DateType class, it is generating SMALLDATETIME instead of DATETIME.

I checked the code (liquibase 3.1.1) and we have that explicity condition in liquibase.datatype.core.DateType class:

@Override
    public DatabaseDataType toDatabaseDataType(Database database) {
        if (database instanceof MSSQLDatabase) {
            try {
                if (database.getDatabaseMajorVersion() <= 9) { //2005 or earlier
                    return new DatabaseDataType("SMALLDATETIME");
                }
            } catch (DatabaseException ignore) { } //assuming it is a newer version

        }
        return new DatabaseDataType(getName());
    }

Why? 

NOTE: I already solved my issue by extending DateType class with a higher priority.

Thank you in advance!

DefaultValueComputed isn't honored when column type is VARCHAR2

$
0
0
Hi

I'm running liquibase 3.1.1 on an Oracle DB. I have a change that creates a table with a column of type VARCHAR2(255) and it should have SYS_GUID as default value: defaultValueComputed="SYS_GUID()".
The resulting sql from this change is: CREATE TABLE person (guid VARCHAR(255) DEFAULT 'SYS_GUID()');
I was expecting "default SYS_GUID()" without the '.

A bug perhaps?

Regards,
Christian
Viewing all 2993 articles
Browse latest View live


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