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

Re : Support AutoIncrement in creating objects

$
0
0
Hi Steve.

This is not the answer, that i was hoping for, but i think you're right and Liquibase does a very good job managing the schema changes. Thanks a lot.

Volker.

liquibase do not drop sequences in Postgres in case dropFirst is true (tested on 3.1.1,3.3.2)

$
0
0
Hello Nathan,

I've noticed liquibase do not drop sequences in postgres  in case dropFirst is true.
(tested on postgres 9.3, liquibase 3.1.1, 3.3.2)

in case it is a bug I can submit a bug request to jira.

as a workaround one can add the following to the begin of the db-changelog.sql file
--changeset youName:1 context:test failOnError:true
DROP SEQUENCE IF EXISTS your_sequence;

PS Thank you for supporting this great project!

Regards,
Vitaliy

Avoid checksum using entire file path

$
0
0
Hello,

i am using liquibase 3.3.2 into an enterprise java webapp.

I have a big problem, my development team has different liquibase file's path using single database.

When we start liquibase bean in apache camel application, liquibase don't match same file into LIQUIBASECHANGELOG table because the root path FILENAME is always different.

I remember that in an older liquibase version, the filename does not change the checksum calculation.

In this version, can use liquibase using same files with different root path? Can i avoid checksum calc using FILENAME columns?

thank a lot

FABRYPROG



Re : How to create a "super"-table which will be always created infront of any table?

$
0
0
Hello Steve,

I have created a patch and a pull request like we talked and I promissed.

https://liquibase.jira.com/browse/CORE-2309

Could you verify the pull request to your needs?
If there is something to fix, please let me know.

Right now we are testing additionally in the whole team with a locally build 3.4.0-SNAPSHOT version. I will let you know if we find an issue.

bye,
Darko

Re : How to create a "super"-table which will be always created infront of any table?

$
0
0
While I work closely with Nathan (founder and core maintainer of Liquibase) I do not have commit rights to the project. Nathan is in the midst of moving houses, so it might be a few days before he gets to your pull request. He is good about giving feedback though. 

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

Re : Problem with Preconditions in Version 3.3

$
0
0
I have the same issue even without preconditions defined. When upgrading from version 3.2.2 to 3.3.2, Liquibase suddenly runs a "SHOW FULL COLUMNS..." query for every table in the database.

To verify the difference, I created a database (MySQL) with 3 tables and ran liquibase with "updateSQL" on both versions. Below is the output of the general query log for each run.

With Liquibase 3.2.2:
  1. Connect    root@localhost on test
    Query    SHOW SESSION VARIABLES
    Query    SHOW COLLATION
    Query    SET character_set_results = NULL
    Query    SET autocommit=1
    Query    SET sql_mode='STRICT_TRANS_TABLES'
    Query    SELECT USER()
    Query    SET autocommit=0
    Query    SELECT USER()
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangeloglock'
    Query    select count(*) from test.DATABASECHANGELOGLOCK
    Query    commit
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangelog'
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangelog'
    Query    SHOW FULL COLUMNS FROM `databasechangelog` FROM `test` LIKE '%'
    Query    SELECT MD5SUM FROM test.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangelog'
    Query    SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,EXECTYPE,DESCRIPTION,COMMENTS,TAG,LIQUIBASE FROM test.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
    Query    commit
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangeloglock'
    Query    select count(*) from test.DATABASECHANGELOGLOCK
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangeloglock'
    Query    rollback
    Query    commit
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangeloglock'
    Query    rollback
    Query    commit
    Query    rollback
    Query    rollback
    Query    SET autocommit=1
    Quit    

Liquibase 3.3.2:

  1. Connect    root@localhost on test
    Query    SHOW SESSION VARIABLES
    Query    SHOW COLLATION
    Query    SET character_set_results = NULL
    Query    SET autocommit=1
    Query    SET sql_mode='STRICT_TRANS_TABLES'
    Query    SELECT USER()
    Query    SET autocommit=0
    Query    SELECT USER()
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangeloglock'
    Query    select count(*) from test.DATABASECHANGELOGLOCK
    Query    commit
    Query    rollback
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangelog'
    Query    SHOW FULL TABLES FROM `test` LIKE '%'
    Query    SHOW FULL COLUMNS FROM `databasechangelog` FROM `test` LIKE '%'
    Query    SHOW FULL COLUMNS FROM `databasechangeloglock` FROM `test` LIKE '%'
    Query    SHOW FULL COLUMNS FROM `table1` FROM `test` LIKE '%'
    Query    SHOW FULL COLUMNS FROM `table2` FROM `test` LIKE '%'
    Query    SHOW FULL COLUMNS FROM `table3` FROM `test` LIKE '%'
    Query    SELECT MD5SUM FROM test.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL
    Query    SHOW FULL TABLES FROM `test` LIKE 'databasechangelog'
    Query    SELECT FILENAME,AUTHOR,ID,MD5SUM,DATEEXECUTED,ORDEREXECUTED,EXECTYPE,DESCRIPTION,COMMENTS,TAG,LIQUIBASE FROM test.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
    Query    commit
    Query    rollback
    Query    rollback
    Query    commit
    Query    rollback
    Query    rollback
    Query    SET autocommit=1
    Quit

As you see, in the latter example it runs queries like "SHOW FULL COLUMNS FROM `table1` FROM `test` LIKE '%'" for each of the tables in the database. And in rainer.spruenkens case, this will lead to the execution of 26.000 queries...

Duplicate changeSet not failing as expected

$
0
0
So I have an Oracle database which I am updating...  in the process of testing my DB build system, I created a new change which is identical in content to an older change with a different ID.  Both are adding a column with the same name, using SQL.  I would expect the 2nd to fail, since it would attempt to create a column which already exists, but the liquibase command updateTestingRollback reports:
Liquibase 'updateTestingRollback' Successful

Any ideas what the potential cause may be?

<changeSet id="4" author="anonymous" failOnError="true">
  <comment> - </comment>
  <sql>ALTER TABLE person ADD (col_a VARCHAR(1));</sql>
  <rollback>ALTER TABLE person DROP COLUMN col_a;</rollback>
</changeSet>

<changeSet id="5" author="anonymous" failOnError="true">
  <comment> - </comment>
  <sql>ALTER TABLE person ADD (col_a VARCHAR(1));</sql>
  <rollback>ALTER TABLE person DROP COLUMN col_a;</rollback>
</changeSet>

Installing extensions, where do the jars go?

$
0
0
I would really like to use the Percona extension, but need a really basic question answered:

Where does the "liquibase-percona-1.1.0.jar" file go?

I have it in /usr/share/liqubase/lib but am unable to have my liquibase installation 'see' it. 
Perhaps there is some other issue with my pom files?

Contexting of include tags?

$
0
0
Hello,

i did a bit of research in this forum bu did not find this topic yet.

We are thinking about using Liquibase for out database migration.Due to a large amount of tables and as we have seen that it's a best practice, we separate our changelogs into several samller ones and let them be integrated by a central file.

Now my question is:
Is there a way to use any execution control in the include tag? Like the contexting or labeling of changeSets?
The structure we would like to set up is that there is a central changeLog which includes a bunch (2-5) of other changeLogs which each have like 50-200 changeLog children. And every time the main changelog is supposed to execute only one of the 2-5 branches.

At the moment during development we handle this by commenting in and out, but a function like contexting includes would be really helpful!

Thanks in advance,

Ben

Unable to rollbackdate using maven

$
0
0
Hi,

I'm trying make the rollbackdate in liquibase using maven with this command:

mvn liquibase:rollback -Dliquibase.rollbackDate="31/03/2015 13:27:27.708852"

The problem is that liquibase is erasing all in the database, all lines of the "databasechangelog".

Example:
______________________________________________________________________________________
"1";"user1";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.0.sql";"2015-03-31 13:24:27.629078";1;"EXECUTED";"7:fb66ab871574ab62f972be32c294940f";"sql";"''";"";"3.3.2"

"2";"user2";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.0.sql";"2015-03-31 13:24:27.66359";2;"EXECUTED";"7:95a4c1c692532b5f1f3686b903eefb18";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.1.sql";"2015-03-31 13:24:27.69319";3;"EXECUTED";"7:e7c3541d5c0baed2ef9b04017786ca6b";"sql";"''";"";"3.3.2"

"1";"user1";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.2.sql";" 2015-03-31 13:24:27.708852 ";4;"EXECUTED";"7:b6f4e79c9d6f194fb4f8dd17ff6fb225";"sql";"''";"versao_1.0";"3.3.2"
--> ROLLBACK MUST BE UNTIL HERE, like running direct on liquibase.

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.3.sql";"2015-03-31 18:48:10.438653";5;"EXECUTED";"7:64cdb84f9c54f4256159f510109cf2d0";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.4.sql";"2015-03-31 18:48:10.485542";6;"EXECUTED";"7:86a3b6d23180e5717052eb160273e990";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.5.sql";"2015-03-31 18:48:10.513993";7;"EXECUTED";"7:4ed740502a27c978f4b5310d36f154ff";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.6.sql";"2015-03-31 18:48:10.535638";8;"EXECUTED";"7:53531736d961464555da6d1f2995e663";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.7.sql";"2015-03-31 18:48:10.557478";9;"EXECUTED";"7:491ddab01932fdb3398d1029ba75f47c";"sql";"''";"";"3.3.2"

"3";"user3";"c:/Users/jmorais/workspace/Hongkong/aps-webservice/aps-database/src/main/sql/script1.8.sql";"2015-03-31 18:48:10.582068";10;"EXECUTED";"7:f44e945fc69b6ab83dbcf5597ad568ca";"sql";"''";"versao_2.0";"3.3.2"
______________________________________________________________________________________
But, everything done is rollbacked.

Ps -> Not is a problem with the date format, I think, because changing the format the liquibase give me a error.

When a use by tag, I have no problem:

mvn liquibase:rollback -Dliquibase.rollbackTag=versao_1.0

In this case, I stay with 4 scripts, until the script1.2.


Somebody can help me? Why the rollbackDate is erasing all? I didn't find nothing in the internet.


Thanks in advance,

Re : Liquibase doesn't honor type modifiers

$
0
0
I have tested this with version 3.2.3 and it works fine, so until the bug is fixed, you could use version 3.2.3.

Re : Installing extensions, where do the jars go?

$
0
0
How are you running Liquibase? Command Line? Maven? Ant?

Re : Installing extensions, where do the jars go?

$
0
0
Using maven.  I figured it out for command line, but cannot get maven to use the liquibase-percona extension

sqlFile not being called

$
0
0
I originally asked this question on stackoverflow but its been nearly a month and I haven't had any feedback and I still can't make this work.   I have a sql file that I would like run to seed my database table with state information.  I tried using a CSV file, but that didn't work either.  I don't see any errors in the logs so I don't know if its a matter of the file not being found, or it just silently failing.  My tables are created, so I know Liquibase is working correctly otherwise.

My current changelog-master.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">


<changeSet id="1" author="dclark">
<createTable tableName="STATE">
<column name="code" type="VARCHAR(10)">
<constraints primaryKey="true"/>
</column>
<column name="name" type="VARCHAR(100)"/>

</createTable>
...
</changeSet>


<changeSet id="2" author="dclark">
<sqlFile path="classpath:states.sql" relativeToChangelogFile="true"/>
</changeSet>

</databaseChangeLog>


I am pretty sure its a classpath issue, but this occurs when running from within IntelliJ or on the commandline with gradle

Re : Avoid checksum using entire file path


Re : Installing extensions, where do the jars go?

$
0
0
Try adding the plugin dependency inside the plugin itself.
  1. <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>3.3.2</version>
        <configuration>
            <propertyFile>src/main/resources/liquibase/liquibase.properties</propertyFile>
        </configuration>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                    <goal>update</goal>
                </goals>
            </execution>
        </executions>
        <dependencies>
            <dependency>
                <groupId>com.github.adangel.liquibase.ext</groupId>
                <artifactId>liquibase-percona</artifactId>
                <version>1.1.0</version>
            </dependency>
        </dependencies>
    </plugin>


Merging ChangeSets

$
0
0
Hi everyone,

I am facing the following requirement:
  1. Developer A adds a first ChangeSet with <addColumn tableName="ARTICLE"> to add a column
  2. Later Developer B adds a second ChangeSet with <addColumn tableName="ARTICLE"> to add another column to the same table
  3. Before pushing these changes to production, the DBA calls for merging these 2 changes in a single one because this ARTICLE table contains a large number of rows. As a result, this changes needs to be optimized.

How can we do that with Liquibase?

Using preconditions, I can do something to prevent ChangeSet 3 from running if ChangeSet 1 or 2 have already been applied. On the contrary,  how could I prevent 1 and 2 from running (and let 3 run) when neither 1 nor 2 have been applied?

Gérald

marlNextChangeSetRan and failed ChangeSet

$
0
0
Hello,

From what I have experimented with Liquibase:
  • When a ChangeSet execution ends in error, the row is not inserted in the CHANGELOG table
  • When I run markNextChangeSetRan it takes the first not ran ChangeSet and insert it into the CHANGELOG table no matter it was ran (and failed) or not
This can raise problems: after a ChangeSet execution failure, I run it manually (needed local patch), and run markNextChangeSetRan twice. In this scenario, the second markNextChangeSetRan execution was a mistake, the following ChangeSet has been inserted  in the CHANGELOG without being run at all. In the end this markNextChangeSetRan operation is tricky because you need to know where Liquibase stopped last time.

Inserting a failed ChangeSet in the CHANGELOG table would allow a "markFailedChangedSetRan" to do something only if such a row exists.

What is the purpose of this markNextChangeSetRan operation?

Gérald





How I input a comment "tag" in a sql script?

$
0
0
I would like populate the column tag by the script sql, is possible?

The others columns is populated like this:

------------------------------------------------------------------------
--liquibase formatted sql

--changeset jmorais:1
--comment MASTER C306330
--tag versao1.0

But the line "tag" dont go to table "databasechangelog"

Thanks in advance,

executeCommand bash script echo show only after the script is complete

$
0
0
We have a custom script that log it progress so we can track where it is.
All the echo are show in the terminal only after the script complete it execution.

here si the changelog

<changeSet id="changesetID" author="user">
    <executeCommand executable="${project.build.directory}/classes/changelogs/init/scriptMySql" os="Linux">
      <arg value="someparam"/>
    </executeCommand>
  </changeSet>

here is the logic of the bash script.

#!/bin/bash

nbFile=0
for SQLFile in ${1}/*.sql; do
  nbFile=$((nbFile+1))
done

noFile=1
for SQLFile in ${1}/*.sql; do
  percent=$(printf '%i %i' $noFile $nbFile | awk '{ pc=100*$1/$2; i=int(pc); print (pc-i<0.5)?i:i+1 }')
  echo "File to manage : $SQLFile ($noFile / $nbFile --> $percent%)"

  // manage the file in the folder. 

  noFile=$((noFile+1))
done
echo "end"

So when we do the script we expect that it log each time it start a new file but the log all append after the execution.
Viewing all 2993 articles
Browse latest View live


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