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

dropAll fails when tables have child partitions - postgres

$
0
0
When running dropAll, and the database has a partitioned table, the dropAll process fails when attempting to drop the partitions. (Liquibase version 3.4.1, Postgres 9.4)

master_table
master_table_201508 (partition table)
master_table_201509 (partition table)

"master_table" is created by liquibase, but the partitions are created by a trigger/function

It looks as though liquibase is taking a "snapshot" of the existing tables and then dropping one-by-one. However when the "master_table" is dropped, the partitions are also dropped and liquibase gives the following error when trying to delete the partition tables.

ERROR: table "master_table_201508" does not exist [Failed SQL: DROP TABLE "public"."master_table_201508" CASCADE

Is there a way to work around this? i.e by turning off the cascade delete or changing how the dropAll is handled?

Thanks



Re : Making LiquiBase work with Netezza

$
0
0
I know I am bit late to this party, but has any progress been made for Netezza support?
I looked out on GitHub, but I did not see any Netezza extensions.

Thanks,

Craig

Re : Making LiquiBase work with Netezza

$
0
0
Looks like Russ (who started this thread) has posted just this one question and no replies. I'm guessing that he saw Nathan's reply and decided to do something different. Since it sounds like he (and now you) are the only ones so far asking for netezza support, I bet it hasn't been implemented. 

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

Re : Making LiquiBase work with Netezza

$
0
0
Thanks for the reply Steve.
And yeah...I am thinking you are right.

Re : Translator from MySQL to liquibase

$
0
0
Thank you for the answer. My bad with the ".xlm" typo. I was looking for something to convert individual sql scripts int xml change sets. If there isn't any similar tool around, I'll just make one with the most frequent commands myself. If anybody is interested, I would gladly share it, because I consider it a useful thing to have. Good day to you all.

Re : Silently stopping Liquibase at mid-update

$
0
0

Or is there no way to break your changelog into much smaller pieces? If you have to stop changesets from executing starting at some point, then you should have a way to create much smaller changelogs (with eventually one big changelog composed with includes).
I already have lots of small changesets. Don't understand exactly your suggestion here.

Re : Silently stopping Liquibase at mid-update

$
0
0
I already have lots of small changesets. Don't understand exactly your suggestion here.
 
I was speaking about breaking your big changelog into smaller changelogs (not changesets) and applying only the last ones.

Re : Translator from MySQL to liquibase

$
0
0
Ah, I see what you are saying. In that case, I can see how a tool might be useful. We have written something like that recently using DaticalDB. We have a command line interface for DaticalDB that is somewhat similar to the one for Liquibase, but works with "project" files that can contain connection information for multiple databases. The command line itself is scriptable using groovy. We wrote a groovy script that will do basically what is described above, but for multiple SQL files. Right now our target databases are Oracle and MS SQL Server, so we use their command line tools to apply the SQL scripts to the database, then use the Liquibase diffChangelog command to 'convert' the SQL that was applied to the database into XML changesets. 

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

Re : Silently stopping Liquibase at mid-update

$
0
0
Your answers gave me an idea and since we are dynamically creating an include changelog file, for all the smaller changelogs, I simple iterate all the smaller changelog files until I reach the file from each things can be executed or not.
Then I execute a query to check for the specific condition, and if everything run ok, I create another dynamic changelog file with the remaining changelogs.

Re : [SOLVED] - Silently stopping Liquibase at mid-update

$
0
0
If I understand correctly:
  1. You got your changesets in tiny changelog files.
  2. You include all these mini changelogs into an include changelog file generated dynamically at process start, which will include all the changesets created up to this day.
  3. You run the big file.
Is that it ?

In this case, can't you save the last changeset applied by this method and start dynamic generation starting from this saved data ?

Re : Configurable DATABASECHANGELOG table name ?

$
0
0
 I have a DATABASE which is used by different UI applications.

 

EX: TABLE1, TABLE2, TABLE3  - application1

       TABLE4, TABLE5, TABLE6 - application2

       TABLE7, TABLE8, TABLE9 - application3

 

But all tables are in same database here. I need separate Changelog table for each set of tables. If this is possible, how can I achieve this?  

Re : Configurable DATABASECHANGELOG table name ?

$
0
0
Well, create one changelog per application, and run liquibase for each application too, with - as said previously - the parameter -Dliquibase.databaseChangeLogTableName=anameforapp1 and -D getDatabaseChangeLogLockTableName=anameforapp2.

Postgres bpchar Default Value Throwing Error

$
0
0
I have generated a migration from a postgres source but when I try to import that xml migration into a new database I have errors with bpchar columns:

[ERROR] Reason: liquibase.exception.DatabaseException: ERROR: syntax error at or near "N"
[ERROR] Position: 163 [Failed SQL: CREATE TABLE my_table (id BIGSERIAL NOT NULL, group_id BIGINT NOT NULL, award_id BIGINT NOT NULL, archived BPCHAR(1) DEFAULT ''N'::bpchar' NOT NULL, time_created TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL, time_modified TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL)]

Here is what the xml looks like:
<column defaultValue="'N'::bpchar" name="archived" type="BPCHAR(1)">

The defaultValue is being quoted when it imports (it is adding single quotes around it). Is there any way to ask liquibase to NOT add quotes around the default value?

Re : Postgres bpchar Default Value Throwing Error

$
0
0
I forced the defaultValue to defaultValueNumeric but I am not sure if that is the proper solution. 

Re : [SOLVED] - Silently stopping Liquibase at mid-update

$
0
0

That's what I'm doing.

I create two "include changelog file".

One that runs all the "tiny changelog files" until the point where the next "tiny changelog files" merged into a "include changelog file" may run or not, based on a specific condition.

Liquibase 3.4.1 - unsupported database Exasol issue

$
0
0
I try to get Liquibase working with unsupported database Exasol and get the following error while Liquibase tries to update table DATABASECHANGELOGLOCK:

Unexpected error running Liquibase: Error executing SQL UPDATE LB_EXA.DATABASECHANGELOGLOCK SET LOCK
ED = TRUE, LOCKEDBY = 'XXXXXX(xxx.xx.xx.x)', LOCKGRANTED = '2015-08-14 11:22:00.694' WHERE I
D = 1 AND LOCKED = FALSE: Feature not supported: Incomparable Types: DECIMAL(1,0) and BOOLEAN! (Sess
ion: 1509478963610076197)

I had to adapt create table statement to Exasol syntax before:

CREATE TABLE DATABASECHANGELOGLOCK (
    ID          DECIMAL(10,0) IDENTITY,
    LOCKED      DECIMAL(1),
    LOCKGRANTED TIMESTAMP,
    LOCKEDBY    VARCHAR(255) UTF8
);
ALTER TABLE DATABASECHANGELOGLOCK ADD CONSTRAINT DATABASECHANGELOGLOCK_CON PRIMARY KEY(ID) ENABLE;

Modify the table statement column LOCKED using VARCHAR(5) to fit value FALSE raises another a different error:

Unexpected error running Liquibase: java.lang.ClassCastException: java.lang.Boolean cannot be cast t
o java.lang.Integer

Can anyone help what to do?

Thanks in advance
Lutz

Re : Liquibase 3.4.1 - unsupported database Exasol issue

$
0
0
Are you writing a new Exasol database adapter? If so, then you will need to do the translation from Boolean to Integer and back. 

If your code is somewhere public like Github, etc., please share a link. 

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

Error finding parent directory when using valueClobFile attribute

$
0
0

I am currently using liquibase to carry out an update to an existing table in a sql database. I have included the xml script which i have written below.

 

The problem occurs when trying to use the valueClobFile attribute. I am trying to specify a file location in another parent directory, However the liquibase script does not like redirecting more than one parent directory up. For example in the code below the file path of valueClobFile="../customer-data/CustomerDesc.json" works perfectly.

 

However when trying to navigate more than one parent directory up, the file path seems to fail. e.g.

valueClobFile="../../raw-data/customer-data/CustomerDesc.json"

 

<changeset id="add customers" auther="jaypal">

      

      <update tableName="CUSTOMER_LIST">

            <column name="RAW_DETAILS" valueClobFile="../customer-data/CustomerDesc.json">

            <where>schema_name = 'engines'</where>

      </update>

 

</changeset>

 

Is there an existing bug in the code that doesn't let you reference a file path which is located more than 2 parent directories up?

Re : Error finding parent directory when using valueClobFile attribute

$
0
0
When you say "seems to fail", what do you mean? Are you getting an error message? If so, what is the message? 

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

Error running yaml changelog after using generateChangeLog on database

$
0
0
Hello,
I'm wondering if someone can provide me some direction on what I'm doing wrong in generating my yaml file.  I currently have my changelogs in xml and it was decided we would convert everything to yml.  I used the generateChangeLog on my database that was built using the xml to reverse it all into yml.  When I try to run my liquibase update with the newly created yml files in a clean database I'm receiving an error.  What is happening is my datetime fields that have a defaultValueComputed: CURRENT_TIMESTAMP are being translated to now() in the sql statement and throwing an error during my run.  This is what the generateChangeLog created in the create table statement:
        - column:
            constraints:
              constraints:
                nullable: false
            defaultValueComputed: CURRENT_TIMESTAMP
            name: CreateDateTime
            type: datetime(6)
and here is the error:
Unexpected error running Liquibase: Invalid default value for 'CreateDateTime'
...inside the create statement - CreateDateTime datetime(6) DEFAULT NOW() NULL

In case it helps the table that exists in the database was created with the column looking like this in xml:

           <column defaultValueComputed="CURRENT_TIMESTAMP" name="CreatedDateTime" type="datetime">
                <constraints nullable="false"/>
            </column>

I am using liquibase 3.4.1

Thank you!
Viewing all 2993 articles
Browse latest View live


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