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

Re : "runalways" changesets seem to break rollback functionality

$
0
0
What about using the changeLog Parameter within the changeSet name, something like this:
  1. <changeSet id="tag-${build.number}" runOnChange="true" author="me">
  2.   <tagDatabase tag="${build.number}"/>
  3. </changeSet>
You will lose the ability to see the tagging changeSets physically in the ChangeLogFile, but you will get the tags you want.

Re : Announcing DB-Manul, a Liquibase fork for continuing and enhancing Liquibase

$
0
0
Hi Nathan,

Bingo, that was the cause. I also verified the other JDBC drivers and changed the pom.xml so that compatible versions are used now. On my test VM, all embedded OSS RDBMS + MariaDB + PostgreSQL are working :) I will verify the rest (including commercial RDBMS) later when I get access to my primary machine again.

Cheers,
Andreas

P.S. This thread is getting a little lengthy, shall we move to the Developer's subforum and create topics for new sub-tasks?

Re : "runalways" changesets seem to break rollback functionality

$
0
0
Daniel,

Thanks for your help, that is certainly a lot better than what I currently have!

There is still a small issue with the functionality, but I am convinced that it should not pose to much of a problem for my usage

The databasechangelog record for the tag operation will not be removed when performing a rollback operation unless I make sure I pass the same ${build.number} value in to the liquibase command. Otherwise, liquibase would perform in the same way as if it couldn't find the changeset in my changelog, and skip it during rollback.

Take the following scenario as an example:
  1. Update to build 1
  2. Update to build 2
  3. Update to build 3
  4. Rollback to build 1
  5. Update to build 3
At step 4, I would only have 3 databasechangelog records, one for each of the tag commands.

At step 5, the changeset for tagging build 3 would be bumped to the top/end again, but the changesets for tag 1 and 2 would be left at the bottom/start of the databasechangelog.

If I now attempt to rollback to build 2, It would rollback all of the changesets (or at least the same amount as trying to rollback to build 1). 

As I said, not a big deal to me, but thought it worth adding here.

Thanks again.

Re : "runalways" changesets seem to break rollback functionality

$
0
0
Hi Sam,

good point, didn't think about that.
Just a wild guess, you may add a rollback to your tagging ChangeSet, that does the cleanUp in the Liquibase History Table for you.

  1. <rollback>
  2. delete from liquibasechangelog where ID > 'tag-${build.number}' and AUTHOR= 'me' and FILENAME ='<your-changelog-file-here>'
  3. </rollback>
I see this is pretty raw especially as it may cause problems when the buildnumbers do not fit into string comparison (jumping from 999 to 1000, comparing real numbers is certainly better but i guess you get the idea). and you'll still have to pass the targeted build number around... but I don't see how this can be fixed.

kind regards
Daniel

Re : Announcing DB-Manul, a Liquibase fork for continuing and enhancing Liquibase

Re : Data Migration between environments

$
0
0

Hi,

Please can you assist, in the same query. We are also having the sql files and wanted to convert the liquibase format.

How can we do it.


Thanks

Rupesh

Re : Translator from MySQL to liquibase

$
0
0
Hi,

I need the assistance to convert the oracle sql files into liquibase xml format and then migrate to Postgresql DB.
As there are list of sql's + Data which are XML format of internal application tool , which need to migrate to liquibase tool and to postgresql DB.

Please let me know you assistance and ant other tools.


Thanks
Rupesh

Re : Translator from MySQL to liquibase

$
0
0
The easiest approach is to execute the SQL files against your oracle database, then run generateChangeLog which will output the xml changelog needed to create the database. 

You may need to modify some datatypes to make the changelog work against postgresql, but it will be a fairly simple "try/see errors/search and replace/try again" cycle until it works.

Nathan

Re : Translator from MySQL to liquibase

$
0
0
Hi,

Thanks very Much.

Do we have tool to migrate?  and what abt CLOB and BLOB datatypes, as it does not generated if extracted from oracle DB. we need to specify manually valueBlobFile and valueClobFile. This is very  tedious job for files which are more than 1000+ files.  

So need to some tool which will convert the sql files and convert to Liquibase format and after it will be easily migrated to Postgresql.


Thanks
Rupesh

Re : "runalways" changesets seem to break rollback functionality

$
0
0
Thanks again Daniel.

Think I have enough to work around the issue for my needs.

Cheers.

Re : Translator from MySQL to liquibase

$
0
0
Hi,

Please can you reply urgently, we need assistance on it.


Thanks
Rupesh

Re : Data Migration between environments

$
0
0

Hi,


Please can you reply urgently, we need assistance on it.




Thanks

Rupesh


Re : Translator from MySQL to liquibase

$
0
0
There is nothing that I know of in Liquibase that can help convert CLOB or BLOB datatypes. 

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

Unable to tag the database using Liquibase for future rollback

$
0
0

I am trying to tag the database for future rollback using but getting below error:

Applying updates to the database. This may take a few minutes ... Unexpected error running Liquibase: Error parsing line 12 column 6 of ppsdb/ebidb_lb_upgrade_c43_sql_1.xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'sql'. One of '{"http://www.liquibase.org/xml/ns/dbchangelog/1.9":modifySql}' is expected.

Here is my changeSet file:

cat ebidb_lb_upgrade_c43_sql_1.xml

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<changeSet author="avnish_plsql_upgrade" id="1">
<tagDatabase tag="version_1.3"/>
<sql
        stripComments="false"
>
create table test (id number);
</sql>
</changeSet>
</databaseChangeLog>

When I am removing <tagDatabase> tag from file, I am not getting any error. It is only when I am adding this tag, I am getting above error. Please let me know, if I am missing any thing or making any mistake here.

Triggers, Procs and Functions not working in H2

$
0
0
Hi,

Triggers/SQL Types/Procedures not working in H2.

Liquibase version :3.5.3

Samples in my sql file
-----------------------------
create or replace PROCEDURE myProc
END myProc;
/


Trigger:-
---------
CREATE OR REPLACE TRIGGER my_trigger
            After INSERT OR UPDATE
            ON sample_TBL
end;
/

Tried adding endDelimiter like below:-
<sqlFile endDelimiter="\n/\s*\n|\n/\s*$" path="src/main/resources/mysqlFile.sql" splitStatements="false" />
But getting the error like below:-
Reason: liquibase.exception.DatabaseException: Syntax error in SQL statement "CREATE OR REPLACE TRIGGER 
[ERROR]             / "; expected "., INSTEAD, BEFORE, AFTER"; SQL statement:


The same error exists for SQL types and function creation.Please help.
Thanks.

Do not create Databasechangelog and Databasechangeloglock tables?

$
0
0
I am using liquibase-core-3.4.2.jar to execute sql file in one of the schema from command line. We noticed that Liquibase is creating 2 tables to track changesets. Our script will be executed in different database as it is kind of utility sql.
Our DBA is requesting not to create Databasechangelog and Databasechangeloglock tables. How do I avoid creating Databasechangelog and Databasechangeloglock tables?

Here is the command.

java -jar  liquibase-core-3.4.2.jar update


Here is the directory structure.

-rw-r--r--  1 lok362  COF\Domain Users      673 Jul 14 06:39 master.xml

-rw-r--r--  1 lok362  COF\Domain Users  2065116 Jul 14 06:41 liquibase-core-3.4.2.jar

-rw-r--r--  1 lok362  COF\Domain Users   676535 Jul 14 06:41 postgresql-9.4.1212.jre7.jar

-rw-r--r--  1 lok362  COF\Domain Users     2390 Jul 14 13:49 createdb.xml

-rw-r--r--  1 lok362  COF\Domain Users      324 Aug  2 10:56 liquibase.properties

How to do a multi line insert query.

$
0
0
How do I make a multiline value on an insert query?

What I tried:
 <column name="ColumnExample" type="varchar2(500)" value="
doc:application/msword \n docx:application/vnd.openxmlformats-officedocument.wordprocessingml.document \\n
gif:image/gif \\\n >
But it just literally insert the values instead of creating  new lines.

Is there a special character i'm missing to escape, or some trick to creating multiple line values? 

What it should be :
"
Line 1
Line 2
"
What I get
"Line1/nLine2" in the DB.

What I have found: 
https://stackoverflow.com/questions/37104999/liquibase-mysql-store-newline

But this just says: add CDATA  but this issnt allowed anymore, or never was?
<column name="message" value="<![CDATA[
        a
        b
        c
        d
    ]]>"/>
I tried this one but it only creates errors.
" liquibase: The value of attribute "value" associated with an element type "column" must not contain the '<' character."
What am I missing?


Re : How to do a multi line insert query.

$
0
0
Its fixed with:
<column name="CHAR_VALUE" type="varchar2(500)" ><![CDATA[
line1
line2
line3
]]></column>
Where every enter in the XML file in CDATA with a \n
Might wanna add it to the Docs on the 'column' page :)?

Include the same xml file twice.

$
0
0
Hello,

I'm trying to call the same xml twice using the include tag. I get the duplicate identifiers error message.

I looked up the forums and I see that this was resolved - https://liquibase.jira.com/browse/CORE-1887.

I'm on version 3.4.2.

for e.g.

<include file="filename.xml" relativeToChangelogFile="true" />
.
.
.
.
<include file="filename.xml" relativeToChangelogFile="true" />


How do I get past the duplicate identifiers message?

Thanks.

Sybase - createProcedure does not work

$
0
0
Hi all,

We are using Liquibase 3.5.3 with Maven 3.3.0 and Eclipse 4.5.2.  Everything works and we can successfully run a Liquibase build with maven to our Sybase databases.

However, for whatever reason, we can not get the createProcedure to work in a <changeSet>.  Does anyone have a working template of createProcedure against a Sybase database?

We can get the procedure to create by using just simple <sql> elements : The following does work...

  1.     <changeSet author="adym.lincoln@..." id="lbTestLiquibase-1.0.0">
  2.         <sql>
  3.             use our_db 
  4.         </sql>
  5.         <sql>
  6.             if exists(select * from sysobjects where name = 'lbTestLiquibase' and type = 'P') drop procedure lbTestLiquibase
  7.         </sql>

  8.         <sql splitStatements="true" endDelimiter=";" stripComments="false"><![CDATA[
  9. if exists(select * from sysobjects where name = 'lbTestLiquibase' and type = 'P') drop procedure lbTestLiquibase 
  10. ;

  11. CREATE PROCEDURE dbo.lbTestLiquibase
  12. as
  13. BEGIN

  14.     declare @status int
  15.     declare @message varchar(255)
  16.     declare @error int
  17.     
  18.     select 'Version [1.0.1]' as version
  19.     return 0

  20. Error_Exit:
  21.     select @message
  22.     return @status

  23. END
  24. ;
  25. ]]>
  26.         </sql>


The following does NOT work : 


  1.     <changeSet author="adym.lincoln@libertymutual.com" id="lbTestLiquibase-1.0.0">
  2.         <sql>
  3.             use our_db 
  4.         </sql>
  5.         <sql>
  6.             if exists(select * from sysobjects where name = 'lbTestLiquibase' and type = 'P') drop procedure lbTestLiquibase
  7.         </sql>


  8.         <createProcedure 
  9.             dbms="Sybase" 
  10.             encoding="utf8" 
  11.             procedureName="lbTestLiquibase" 
  12.             relativeToChangelogFile="true">
  13. CREATE PROCEDURE dbo.lbTestLiquibase
  14. as
  15. BEGIN

  16.     declare @status int
  17.     declare @message varchar(255)
  18.     declare @error int
  19.     
  20.     select 'Version [1.0.0]' as version
  21.     return 0

  22. Error_Exit:
  23.     select @message
  24.     return @status

  25. END
  26.         </createProcedure>
  27.     </changeSet>

Things I've tried : 

- Adding catalogName and schemaName to the createProcedure...

  1.         <createProcedure 
  2.             dbms="Sybase" 
  3.             encoding="utf8" 
  4.             procedureName="lbTestLiquibase" 
  5.             relativeToChangelogFile="true" 
  6.             schemaName="dbo">

  7.         <createProcedure 
  8.             catalogName="our_db"
  9.             dbms="Sybase" 
  10.             encoding="utf8" 
  11.             procedureName="lbTestLiquibase" 
  12.             relativeToChangelogFile="true" 
  13.             schemaName="dbo">


tia,

adym


Viewing all 1169 articles
Browse latest View live


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