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

Re : Track Database changes made with out using changeset

$
0
0
In order to do the comparison, yes, you will need two databases. Most development shops have more than one copy of their database, but if you don't then all you need to do is create a new empty database and use liquibase to create the schema using the changelogs you have. Then compare that with the one that has the changes made without liquibase to see what the differences are. If you use the diff command, Liquibase will show you a 'human readable' version of the differences. If you use the diffChangelog command, then the changelog will be altered to have the correct change sets to bring the two databases into sync. 

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

Re : How to handle database changes made by an automatic upgrade script?

$
0
0
Hi vvssekhar,

It isn't clear what question you are seeking help with. There were several questions in this thread and several answers. Is there some particular problem you are having? If so, can you please start a new thread?

Thanks!

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

Re : Upgrading from 2.0.5 to 3.2.0 - Problem with preConditions ?

$
0
0
What is the actual state of the database when you run this? Does the column PRICE_IDS exist? 

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

Re : Upgrading from 2.0.5 to 3.2.0 - Problem with preConditions ?

$
0
0
Yes, the column PRICE_IDS exists, and the precondition fail when i execute this code, and never execute the renameColumn.. and of course other scripts depending on that change fail.

Re : Track Database changes made with out using changeset

$
0
0
I think we can use the futureRollbackSQL mode to get what I want.
 

Re : How to handle database changes made by an automatic upgrade script?

Re : Collation support?

$
0
0
Hi!

I am also facing effects of missing support for collation. Having a chance to define custom collation at column element would be helpful. I mean, if there can be support for encoding attribute (which apparently does nothing on MS SQL), one extra attribute for collation would surely not harm anything.

Currently when someone needs to define a custom collation, not neccessarily for the purpose of ordering but also for controlling case sensitivity or accent sensitivity (my situation), then the user is basically left in dark with poor options. If there was at least <modifySql> allowed at column level but unfortunatelly it's not.

Sure, raw <sql> works somehow but it's cumbersome and not really right tool for collation adjustment. MS SQL example:
<sql>
      ALTER TABLE [table] ALTER COLUMN column1 [varchar](30) COLLATE ${collation.insensitive} NOT NULL
</sql>
See? Technically there doesn't seem a way to change collation alone without having to manipulate (redefine!) column type and constraint. I have no desire to define column type constraint twice in the changelog (once in proper table definition and second in sql). That's would be plain bad practise.

Has anyone managed to deal with collation definition in Liquibase changeset in a sensible manner? At this point I am inclined to give up, which would be a pitty.

Tomas

Executing Liquibase.jar via command line

$
0
0
Hi,

Now a days we are executing a shell script that is using a command line to run liquibase.jar. We are using already for one year, and works perfectly.

Few weeks ago, we updated the liquibase.jar to use the version 3.2.2  and now I see the problem that we have the jar hard coded inside the project and we don't know the version that we are running if we don't run the command line. I would like to have more control about the version of the liquibase jar, and know which version we are running.

So I would like to know if there is any solution to can get the liquibase.jar in a pom dependency. There is any reason why it is not in maven repository this jar ? I can fix it creating my own repository in our nexus, but i think would be also useful for other people, to have it public.

Thanks in advance,

LiquiBase Migration 2.0.5 to 3.2.2 runOnChange not executed

$
0
0
Hi,

This morning I just realized that the runOnChange it is not working as should be. 

We were checking this page http://www.liquibase.org/v3_upgrade.html and we saw that there are problems form 2.x version to the 3.x. But it is not clear at all what is the problem and what we should do.

What we see is that the EXECTTYPE is RERAN, and the checksum was the correct one, but we don't have the changes in the database. Also the DATAEEXECUTED is a date in the past.

I fix it deleting that entry from databasechangelog and run it again, and then i get the changes EXECTYPE EXECUTED, and all correct.

It is this a good solution ? do you guys have a better idea ? are you aware of that problem ?

Thanks in advance,


Re : Executing Liquibase.jar via command line

$
0
0
The liquibase-core jar contains the command line interface and is located in Maven Central. You can use the following pom definition:
  1. < dependency >
         < groupId >org.liquibase</ groupId >
         < artifactId >liquibase-core</ artifactId >
         < version >3.2.2</ version >
    </ dependency >


Re : Executing Liquibase.jar via command line

Re : Executing Liquibase.jar via command line

$
0
0
It is working perfectly! thanks!!

Re : Upgrading from 2.0.5 to 3.2.0 - Problem with preConditions ?

$
0
0
Just to add more information:
- We are using Oracle database 11g

this conditions are not working in 3.2.2
columnExists  
- TableExists
(and maybe more)

Debugging the code, looks like is trying to find the table in the schema that you are executing (the one that you are executing), but doesn't use the schema specified in the precondition.

We are running with RELEASE user and we want to check if the column exist in ATI schema... but i think it is not used the schemaName attribute.

Thanks in advance,

CreateView and schema

$
0
0
Hey guys (and possible girls :)

I have found an interesting "issue" when using LiquiBase to create database views.
My app is running on WebSphere and using JNDI data source that has no scheme defined (as it is used by more then one application and each application specifies schema in its own configuration).

In Hibernate I can specify schema using :
  1. <prop key="hibernate.default_schema">${jdbc.schema}</prop>
In LiquiBase I can do the same using Spring's integration :
  1. <bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase">
  2.         <property name="dataSource" ref="dataSource" />
  3.         <property name="changeLog" value="classpath:db-changelog.xml" />
  4.         <property name="defaultSchema" value="${jdbc.schema}" />
  5.     </bean>
Now imagine that I have a view to be created :
  1. <changeSet author="zbynek" id="create_view_mad_server_properties_joined">
  2.         <comment>replaceIfExists is not allowed on db2</comment>
  3.         <createView viewName="MAD_SERVER_PROPERTIES_JOINED">
  4.             SELECT ROWNUMBER() OVER() as ID, MAD_SERVER_ID as MAD_SERVER_ID, SUBSTR( xmlserialize
  5.             (xmlagg (xmltext (concat (',', MAD_SERVER_PROPERTY.NAME))) AS VARCHAR(255)), 2)
  6.             as PROPERTIES FROM mad_server INNER JOIN MAD_SERVER_TO_PROPERTY ON MAD_SERVER_TO_PROPERTY.MAD_SERVER_ID
  7.             = mad_server.ID INNER JOIN MAD_SERVER_PROPERTY ON MAD_SERVER_TO_PROPERTY.PROPERTY_ID
  8.             = MAD_SERVER_PROPERTY.ID GROUP BY MAD_SERVER_ID
  9.         </createView>
  10.     </changeSet>
When this changeSet gets executed it will look for table 'mad_server' (please don't laugh) in default schema (which is same as DB user) rather than in schema I provided via Spring.And since the table is in schema I provided this SQL fails - obviously.
I could put SCHEMA.mad_server into the SQL but that would loose the portability.

Any idea how this could be done? Or is it database (or DB2) related "issue"/feature.

All this happens on DB2 9.7.


Thanks !

PS : If I use local data source with schema specified it work fine !

Re : How to reference new change in xml file

$
0
0
This is exactly what I was looking for.

Can I also do something like

  1. <changeSet id="1" author="me">
  2.         <ext:myChange attribute1="x">
  3.               <ext:nested>blah blah blah</ext:nested>
  4.         </ext:myChange>
  5.     </changeSet>
Or would I need to create my own xsd for that?

Howto set/override changeset description

$
0
0
I just wrote my first extension and now want it to generate a bit more than my tag name in the description field of the databasechangelog.

Looking through the AbstractChange class my first thought was to override 
createChangeMetaData( ) to make the metadata contain some parameter information but that failed because this method runs before by extensions is fully registered.

I then tried overriding setChangeSet but that caused problems because ChangeSet does not have a setDescription method.

What is the "correct" way for a Change to place more detail in the changeset description? 

Re : Seems like runOnChange or runAlways is default in 3.2.2

$
0
0
It is strange you are seeing that. RunOnChange defaults to false so if the checksums change you should get validationErrors, not re-execution.  Also, the checksum is normally done against a standardizes version of the XML, not the generated SQL. 

One thing that can cause people to see re-execution of changeSets is if the changelog file path changes. The path is part of the changeset identifier, so if you move the file or refer to it differently, it will count the changeSet as different. You should be able to select from the databasechangelog table to see the path of the changeSets previously executed and compare them to what Liquibase thinks it is now.

If it is not a problem with the path, could you post an example of the debug log and/or the changelog?

Nathan

Re : Liquibase: changeLogPropertyDefined doesn't work

$
0
0
Yes, by default preconditions aren't evaluated in updateSQL unless you use the onSqlOutput="TEST" attribute.

Nathan

Re : LiquiBase Migration 2.0.5 to 3.2.2 runOnChange not executed

$
0
0
Yes, the trouble is that while I try to avoid changes to the checksum logic, sometimes it is not preventable. When there is a change in the logic, that means we cannot know if a changeSet has changed or not and so what should be done with a runOnChange="true" changeSet? Do you run it or do you not? 

You can make an argument either way but the way that was chosen was to assume they did not change and therefore not run them and just update the checksum with the new logic. 

If you have changeSets that you know changed and so you want to be ran when you are upgrading from 2 to 3, the easiest solution is probably to change the ID, that way it is seen as a new changeSet and is re-ran regardless. 

Nathan

Re : Howto set/override changeset description

$
0
0
The easiest way is to use the @DatabaseChange annotation on your class. If you extend AbstractChange, the superclass will build up the description from the information in the annotation, including the "description" attribute.

Nathan
Viewing all 2993 articles
Browse latest View live


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