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

liquibase comments in sql formatted changelogs

$
0
0

I have a requirement to retain Oracle SQL comments made inside my Liquibase sql formatted changelogs. Thus I have the following attribute set stripComments:false

Such comments in my SQL formatted changelogs are typically supplied using the standard -- (hyphen hyphen) characters

-- DROP LINK

However, it appears that with Liquibase attempts to execute all comments, and in this example, the comment above. This causes my Liquibase update to fail with the following error:

Invalid SQL type: sqlKind = UNINITIALIZED

I have tried to replace all occurances of

-- comment

with

/* comment */

but this also generates the same error.

Anyone have any ideas?


Re : includeObjects not working with generateChangeLog

$
0
0
To answer my own question:
  • includeObjects is not supported via the command line (in 3.3.5)
  • includeObjects is available from the ant task: generateChangeLog
  • the ant task: generateChangeLog doesn't support diffTypes="data"

Ant does 50%, command line does the other 50%, neither allows exporting the data for a single table. Perhaps the maven route works...

Re : Error when trying to generateChangeLog : ORA-00942: table or view does not exist

$
0
0

It turned out to be a permission issue when accessing database metainformation.

So not a liquibase issue but a restrictive corporate setup ... and Oracle returning very generic error messages.

Thanks for your help.

/jørgen

Re : BUG: code comments for sql formated files disappers

$
0
0
By default, the stripComments setting is true, so Liquibase will remove all comments from the SQL before executing it. When defining your changeset, specify "stripComments:false" to prevent this from happening.
  1. --changeset  procedure_x_rbg_comment_test:4 splitStatements:false stripComments:false
http://www.liquibase.org/documentation/sql_format.html

Re : LoadData ChangeSet with "NOW" in the data

$
0
0
You may be able to try defaultValueComputed="'NOW'"  (note that there are single quotes around the NOW inside the double quotes)

Nathan

Re : LoadData ChangeSet with "NOW" in the data

$
0
0
Hello Nathan,

Thank you for the reply.  I should have been more specific, sorry.  This column has nothing to do with dates.  It is a text field with arbitrary text data in it.  So what is happening is it reads in the text 'NOW' and translates that to a date, which then causes it to choke due to the size of the data vs the size it is expecting to put in the column:

liquibase.exception.DatabaseException: java.sql.SQLDataException: data exception: string data, right truncation
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:316)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:122)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1227)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1210)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:550)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:43)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:73)
at liquibase.Liquibase.update(Liquibase.java:200)
at liquibase.Liquibase.update(Liquibase.java:181)
at liquibase.Liquibase.update(Liquibase.java:174)

Wrapped Oracle PL/SQL Code Support By Liquibase

$
0
0
Hi,
 
I am not sure whether we have Liquibase support for Wrapping PL/SQL code before it is deployed on Database.
 
Can any one confirm on this?
 
If it is not supported, it will be nice to have this feature where we can specify whehther we can wrap the code before liquibase deploy Oracle (Packages, Procedure, Functions) Code in database.
 
This feature is helpful when we use liquibase to generate code to be deployed in customer environment.
 
Thanks,
Varun Datta
 
 

Re : BUG: code comments for sql formated files disappers

$
0
0
thanks for the answer, this will definetly solve the problem I have,just for your information I created an liquibase jira (CORE-2383 ) at the same time i created this bug report,as a solution to the jira default value to stripComments been changed to false  in the newer version of liquibase .

Re : runAlways="true" fails if the checksum changed?

$
0
0
I have been using 3.2.0 and had to add `<validCheckSum>any</validCheckSum>` to all of my `runAlways=true` change sets. Seems to me that a runAlways would imply the checksum may change over time.

Also, I find that these change sets are not "always run" when I execute an `update`. Instead, they seem to only be run when new change sets are introduced.

Finally, running `status --verbose` claims that my `runAlways=true` change sets have NOT been applied. This is out-right wrong and completely misleading.

Liquibase modify dbchangelog table

$
0
0
When I run liquibase to generate sql I always get the following lines added to my  output file

-- Modifying size of databasechangelog.md5sum column

-- Modifying size of databasechangelog.liquibase column

ALTER TABLE databasechangelog ALTER COLUMN MD5SUM TYPE VARCHAR(35);

 

ALTER TABLE databasechangelog ALTER COLUMN LIQUIBASE TYPE VARCHAR(20);

I am using a postgres database and those columns have been defined as text.

Is there an option to not generate these modifications?

Bootstrap performance on Oracle with lots of Table

$
0
0
Hello,

A looong time is spent between these two logs:

  1. 10:21:50 INFO  liquibase - Successfully acquired change log lock
  2. 10:22:41 INFO  liquibase - Reading from DATABASECHANGELOG
This Oracle database contains many schemas with lots of tables. The problem doesn't occur on a smaller database.

Is it related to https://liquibase.jira.com/browse/CORE-1858 ?
We are using Liquibase 3.3.1

Gérald

update change with whereParam

$
0
0
Hello,

This used to work in 3.3:
  1.         <update tableName="PERSON">
  2.             <column name="BIRTHDATE" value="1942" type="NUMBER(4)"/>
  3.             <whereParams>
  4.                 <param name="ID" value="1"/>
  5.             </whereParams>
  6.         </update>
But in 3.4 I get:
  1. Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
  2.      1 changes have validation failures
  3.           whereParams set but no whereClause,

What's the appropriate syntax?

Gérald

Strange problem

$
0
0

Hi


I have rather weird problem when creating a column of type timestamp with code below.

The column in the orders table is created as type datetime, whilst the other is correct (timestamp), can anyone offer any clues as to why it is happening.


Thanks


  1.     <changeSet author="chromis - John L" id="Create KitchenScr Table">
            <preConditions onFail="MARK_RAN">
                <not>
                    <tableExists tableName="ORDERS"/>
                </not>
            </preConditions>

            <createTable tableName="ORDERS">           
                <column name="ID" type="varchar(50)" >
                    <constraints primaryKey="true" nullable="false" />
                </column>
                <column name="ORDERID" type="varchar(50)"/>
                <column name="QTY" type="int" defaultValueNumeric="1"/>
                <column name="DETAILS" type="varchar(50)"/>         
                <column name="ATTRIBUTES" type="varchar(255)"/>
                <column name="NOTES" type="varchar(255)"/>
                <column name="TICKETID" type="varchar(50)"/> 
                <column name="ORDERTIME" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>        
                <column name="DISPLAYID" type="int" defaultValueNumeric="1"/>               
            </createTable>
        </changeSet>


        <changeSet author="Chromis - John L" id="Create Draweropened Table">
            <preConditions onFail="MARK_RAN">
                <not>
                    <tableExists tableName="DRAWEROPENED"/>
                </not>
            </preConditions>

            <createTable tableName="DRAWEROPENED">
                <column name="OPENDATE" type="timestamp" defaultValueDate="CURRENT_TIMESTAMP"/>
                <column name="NAME" type="varchar(255)"/>
                <column name="TICKETID" type="varchar(255)"/>

            </createTable>
        </changeSet>


Why does Liquibase want to dropPrimaryKey and addPrimaryKey?

$
0
0
I have Postgres databases generated with Eclipse Link. Between these databases is not any change, but when I run liquibase for generating diffChangeLog, it generates changesets with dropPrimaryKey and addPrimaryKey. I don't understand why it generates these records for all primary keys of all tables. Names, order of columns are the same for both tables.

Example of changeset

  1. <changeSet author="michal2 (generated)" id="1436872322297-8">
            <dropPrimaryKey tableName="country_translation"/>
            <addPrimaryKey columnNames="country_id, translations_id" constraintName="country_translation_pkey" tableName="country_translation"/>
        </changeSet>
Sql of original table

  1. CREATE TABLE country_translation
    (
      country_id bigint NOT NULL,
      translations_id bigint NOT NULL,
      CONSTRAINT country_translation_pkey PRIMARY KEY (country_id, translations_id),
      CONSTRAINT fk_country_translation_country_id FOREIGN KEY (country_id)
          REFERENCES country (id) MATCH SIMPLE
          ON UPDATE NO ACTION ON DELETE NO ACTION,
      CONSTRAINT fk_country_translation_translations_id FOREIGN KEY (translations_id)
          REFERENCES translation (id) MATCH SIMPLE
          ON UPDATE NO ACTION ON DELETE NO ACTION
    )
    WITH (
      OIDS=FALSE
    );
    ALTER TABLE country_translation
      OWNER TO hotels;
Sql of reference table
  1. CREATE TABLE country_translation
    (
      country_id bigint NOT NULL,
      translations_id bigint NOT NULL,
      CONSTRAINT country_translation_pkey PRIMARY KEY (country_id, translations_id),
      CONSTRAINT fk_country_translation_country_id FOREIGN KEY (country_id)
          REFERENCES country (id) MATCH SIMPLE
          ON UPDATE NO ACTION ON DELETE NO ACTION,
      CONSTRAINT fk_country_translation_translations_id FOREIGN KEY (translations_id)
          REFERENCES translation (id) MATCH SIMPLE
          ON UPDATE NO ACTION ON DELETE NO ACTION
    )
    WITH (
      OIDS=FALSE
    );
    ALTER TABLE country_translation
      OWNER TO hotels;
Liquibase command with arguments
  1. ./liquibase \
          --driver=org.postgresql.Driver \
          --classpath=/home/michal2/tools/postgresql-jdbc-driver/postgresql-jdbc.jar \
          --changeLogFile=changelog-hotels.xml \
          --url="jdbc:postgresql://localhost/hotels" \
          --username=hotels \
          --password=hotels \
          --defaultSchemaName=public \
        --logLevel=info \
        diffChangeLog \
        --referenceUrl="jdbc:postgresql://localhost/hotels_liquibase" \
        --referenceUsername=hotels \
        --referencePassword=hotels \
            --referenceDefaultSchemaName=public
I'm using version 3.4.0

How to build statistics for an update run

$
0
0
Liquibase is a great tool. I have just started using it to replace our mix of hand-crafted and generated .sql setup files.
One of the enhancements we'd like to make to our DB setup and upgrade process is to generate statistics on what SQL statements were run, how long they take, how many rows they affected, etc. The data would be in a JSON file that we could easily view in an HTML app.

Does Liquibase have any hooks for accumulating this kind of data? I noticed there are extensions for custom loggers, but I'm not sure if logging is the right layer for this. Are there other extension points that might be better suited to capturing performance data?

Thank you,
AHG

Re : How to build statistics for an update run

$
0
0
There are hooks, but they are not trivial to implement. Datical has been doing just this sort of work on top of Liquibase. It may be more than you need though. 

Logging is not the right place to put this. If you want to do it yourself, start by looking at the ChangeExecListener interface. You will need to run Liquibase programatically and then you can call setChangeExecListener() on the Liquibase object and then get calls back into your code whenever a changeset is run.

It would also be possible to extend the Liquibase integrations so that you could supply a listener via command line or ant or maven, etc.

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

Re : How to build statistics for an update run

$
0
0
Thanks Steve, I'll try out the ChangeExecListener. It looks like it could support what we need. I was planning on running Luquibase programmatically anyway as I need to also orchestrate the database setup and schema creation process.

I'll update this topic with my results.

Liquibase Inheritance creation

$
0
0
Hello

I am new to Liquibase and am using it in one of my projects. Is there a possibility of creating inheritance structure in Liquibase. I would like to create two tables (one parent , one child). I am currently using postgresql database. How can I implement the inheritance such that the child inherits all the columns from the parent table. Is there a specific syntax to declare inheritance in Liquibase (XML syntax). Any help would be greatly appreciated.

Thanks
Shashank

Inheritance in Liquibase

$
0
0
Hello

I am new to Liquibase and am using it in one of my projects. Is there a possibility of creating inheritance structure in Liquibase. I would like to create two tables (one parent , one child). I am currently using postgresql database. How can I implement the inheritance such that the child inherits all the columns from the parent table. Is there a specific syntax to declare inheritance in Liquibase (XML syntax). Any help would be greatly appreciated.

Thanks
Shashank

Re : How to build statistics for an update run

Viewing all 2993 articles
Browse latest View live


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