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

Changeset identifiers - best practises - supporting multiple branches

$
0
0
Team,

Whilst the liquibase documentation doesn't enforce / recommend any particular convention for the identifier I'd be interested in other teams experiences on what worked well / didn't for them and why.  

We could generate an identifier ourselves based on the date and a number sequence e.g. YYYYMMDD-<SEQ> although if others merge changesets in the same day they might get conflicts and resolve sequence numbers. I know it doesn't matter so much even if out of sequence as the key issue is uniqueness however perhaps some schemes are better.  

Have others considered adding bug log / story identifiers from their host system into the identifier too e.g. for JIRA such as JIRA-1234-<seqno> 

Also we may have "newer" changes from old service pack branches merged into master for which we'd want to keep the same changeset identifier presumably i.e. it's the same logical changeset with schema plus data updates in most cases. 

Appreciate your thoughts and we can develop this into a guidance page


Re : Liquibase creates log tables with user schema

$
0
0
I'm not sure and it sounds more like a general SQL Server user permissions issue you might get good answers googling with those keywords.  However for liquibase it may help to simply generate the SQL it produces, log in with that user and then you can validate the owner of the table, make adjustments and test.

Re : Good discussion and review of other database migration frameworks

$
0
0
It seems dbDeploy, migrate4j and MIGRATEdb are abandoned (last release for migrade4j was in 2008, and for dbdeploy in 2009 and MIGRATEdb in 2014)

I just had a brief look at MIGRATEdb and the fact that each change needs to for itself it has already been applied somehow defeats the purpose of such a tool.

The only true contender I know of today, is Flyway which only(?) supports custom SQL scripts.

I still prefer the XML format because it can be used for DBMS independent migrations and allows for some automated analysis of the migrations which is really hard to do with SQL scripts (e.g. we have a little tool that parses the XML and then checks if certain naming conventions are following if each table has a primary key and so on).

It also makes generating a changelogs easier. We also have a set of macros for Toad Data Modeler that allow us to generate the Liquibase Changeset directly from there - in a DBMS independent manner. We even had a set of XLST scripts that would convert the XML of a freeware modelling tool into a Liquibase ChangeLog





includeAll without recursion

$
0
0
I suppose that includeAll is recursive and there is no possibility to make it not recursive, is it correct?

I need this possibility. Is it on your roadmap?

Re : Deployment_id in 3.5.3

$
0
0
Yes, the deployment_id is automatically generated, and there is currently no way to control or supply that value. 

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

Re : Deployment_id in 3.5.3

Re : Changeset identifiers - best practises - supporting multiple branches

$
0
0
We have found it easier to have identifiers as JIRA tickets with optional -01/-02 etc when necessary. It has worked well for us, furthermore it immediately tells you which ticket the changeset belongs to.

Re : Changeset identifiers - best practises - supporting multiple branches

$
0
0
Thanks Raj, yes although the changeset comment could be used to reflect that information too. When you span multiple JIRA tickets for a change do you have any pattern? How do you coordinate numbers between them? 

Given the insignificance of the identifier actually needing to be sequential I'm wondering if a simple GUID auto generated is even better with the changeset comment reflecting other information e.g. the date it was originally created / JIRA entities and so on.  You would never have to worry about whether an identifier was really unique too.



Re : Changeset identifiers - best practises - supporting multiple branches

$
0
0
For multiple tickets for a change, usually we put the main jira ticket number as id and reference all tickets in comments. That seems to work well for us.

Liquibase partially contained database case sensetivity

$
0
0
I have created partially contained database in MS SQL server 2012. Database collation is Cyrillic_General_CS_AS. In contained database this collation applies only for user data and temp data. Database metadata is in default catalog collation - Latin1_General_100_CI_AS_WS_KS_SC. So now i have case-insensetive table names and case-sensetive user data.
In my java application i am trying to modify existing table with liquibase. Database.isCaseSensitive() returns me that my database is case-sensetive. And when i am trying to get existing Table from DatabaseSnapshot it returns me null. But infact this table is exsist in database.

      Table realTable = snapshot.get(table); //returns null

Is there any ways to change this behaviour?

Thank you!

clustered index for MSSQL

$
0
0

I see that in LIQUIBASE 3.3.0 AND 3.2.3 THERE IS NEW ATTRIBUTE:

Support for clustered/nonclustered indexes and primary keys

We installed the latest version(3.5.1 ??)

We're running it on MSSQL

I did the following and got err:

Attribute 'clustered' is not allowed to appear in element 'createIndex'.

    <createIndex 
    indexName="pk_t_premium_rates"
    tableName="t_premium_rates"
    unique="true"
    clustered="true">
<column name="actuary_version_table"/>
<column name="actuary_tab

How to add a complete folder to the classpath?

$
0
0
Hi everybody,

I want to add a complete folder to the liquibase classpath. In this folder, the database-driver is stored.


I neither want to copy the driver to another folder (because it is also part of the shipped product) nor I want to specify the concrete jar-file (because we might change the shipped driver-version).


  1. java -jar liquibase.jar --classpath=../../plugins/ --url="jdbc:postgresql://localhost:5432/mydb" --username="postgres" --password="myPassword" dropAll
The driver is located in the plugins-folder of my application.


But I always get the error, that no driver could be found.


Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver


SEVERE 04.11.16 11:16: liquibase: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:127)
at liquibase.integration.commandline.Main.doMigration(Main.java:958)
at liquibase.integration.commandline.Main.run(Main.java:188)
at liquibase.integration.commandline.Main.main(Main.java:103)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:85)
... 3 more
Caused by: java.lang.RuntimeException: Cannot find database driver: org.postgresql.Driver
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:199)
... 5 more



Re : How to add a complete folder to the classpath?

$
0
0
This is a general limitation of java, not liquibase. To fix this, you would need to write your own launcher - either a new version of java.exe or a wrapper script in the scripting language of your choice. 

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

Is the Gradle plug-in advised?

$
0
0
As I'm new to Liquibase, it might be my ignorance, but I wonder whether the Liquibase plug-in is being advised. I have a hard time making it work for me. I would like to generate a change log based on an existing database schema and a set of Spring/Hibernate classes. I came past many unclear error messages, but now I'm stuck on this:

  1. INFO 11/4/16 8:44 PM: liquibase-hibernate: Reading hibernate configuration hibernate:spring:nu.yona.server.subscriptions.entities?dialect=org.hibernate.dialect.HSQLDialect
  2. INFO 11/4/16 8:44 PM: liquibase-hibernate: Found package nu.yona.server.subscriptions.entities
  3. INFO 11/4/16 8:44 PM: liquibase-hibernate: Found dialect org.hibernate.dialect.HSQLDialect
  4. Unexpected error running Liquibase: Unable to resolve persistence unit root URL

  5. SEVERE 11/4/16 8:44 PM: liquibase: Unable to resolve persistence unit root URL
  6. liquibase.exception.DatabaseException: javax.persistence.PersistenceException: Unable to resolve persistence unit root URL
Given the amount of unclear messages and the little information I could find on the internet, I started to wonder whether I'm trying something that nobody uses.

My question is actually twofold: should I move on with the Liquibase Gradle plug-in? If so, any idea what could cause the above issue?

For your infomation: this is the Gradle file that I use:
  1. description = 'Database initializer'

  2. buildscript {
  3. repositories {
  4. mavenCentral()
  5. }
  6. dependencies {
  7. classpath("org.springframework.boot:spring-boot-gradle-plugin:$project.ext.springBootVersion")
  8. classpath("io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE")
  9. classpath('se.transmode.gradle:gradle-docker:1.2')
  10. classpath 'net.researchgate:gradle-release:2.3.4'
  11. classpath 'org.liquibase:liquibase-gradle-plugin:1.2.1'
  12. classpath("org.hsqldb:hsqldb:2.3.3")
  13. classpath("org.liquibase.ext:liquibase-hibernate4:3.6")
  14. classpath("org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE")
  15. classpath("org.springframework.batch:spring-batch-core:3.0.7.RELEASE")
  16. }
  17. }

  18. apply plugin: 'java'
  19. apply plugin: 'idea'
  20. apply plugin: 'spring-boot'
  21. apply plugin: 'io.spring.dependency-management'
  22. apply plugin: 'docker'
  23. apply plugin: 'net.researchgate.release'
  24. apply plugin: 'liquibase'

  25. jar {
  26. baseName = 'DatabaseInitializer'
  27. }

  28. release {
  29. failOnCommitNeeded = true
  30. tagTemplate = 'adminservice-${version}'
  31. git {
  32. requireBranch = 'yd-40-changes-for-building|master'
  33. }
  34. }

  35. dependencies {
  36. compile project(":core")
  37. compile("org.springframework.boot:spring-boot-starter-data-jpa:1.4.1.RELEASE")
  38. compile("org.springframework.batch:spring-batch-core:3.0.7.RELEASE")
  39. }

  40. group = 'yonadev'

  41. task buildDocker(type: Docker, dependsOn: bootRepackage) {
  42. tag = "${project.group}/yonahsqldb"
  43. push = true
  44. applicationName = jar.baseName
  45. dockerfile = file('src/main/docker/Dockerfile')
  46. doFirst {
  47. copy {
  48. from bootRepackage
  49. into stageDir
  50. rename "${jar.baseName}-${jar.version}-${bootRepackage.classifier}", "${jar.baseName}"
  51. }
  52. copy {
  53. from 'data'
  54. into "$stageDir/data"
  55. }
  56. }
  57. }

  58. bootRun {
  59. enableAssertions=true

  60. systemProperties = [
  61. 'spring.datasource.url': "jdbc:hsqldb:file:../YonaDB",
  62. 'spring.batch.initializer.enabled': "true",
  63. 'spring.jpa.hibernate.ddl-auto': "update"
  64. ]
  65. }

  66. bootRepackage {
  67.         classifier = "full"
  68. }

  69. liquibase {
  70. activities {
  71. main {
  72. changeLogFile 'changelog.groovy'
  73. url 'jdbc:hsqldb:hsql://yonadbserver/xdb'
  74. referenceUrl 'hibernate:spring:nu.yona.server.subscriptions.entities?dialect=org.hibernate.dialect.HSQLDialect'
  75. username 'sa'
  76. password ''
  77. changeLogParameters([ myToken: 'myvalue',
  78. second: 'secondValue'])
  79. }
  80. }

  81. // runList = project.ext.runList
  82. runList = 'main'
  83. }

Re : How to add a complete folder to the classpath?

$
0
0
Thanks for your answer. I never tried it in java, but I thougt, it is possible to add ./my/folder/* to the classpath?!?

However, I solve it within the script.

Best way to create masterdata per tenant?

$
0
0
Hello together,

what is the recommended way of liquibase to handle multi-tenant applications with identical database schema but with different masterdata per tenant?

I was thinking of using contexts, but I am wondering if there is any recommended way of doing it? Especially if I consider, that tentant system may also have altering on the database schema.

best wishes

Re : Is the Gradle plug-in advised?

$
0
0
I am not sure of the state of the gradle plugin - but you may get better response to this question on Stack Overflow than in this forum. It has been my experience that there are more people answering questions on S.O. than here. 

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

Re : Is the Gradle plug-in advised?

$
0
0
Thank you Steve!
As I guessed so too, I posted it there yesterday. I didn't ask the advise question there, as S.O. doesn't like opinion questions. The underwhelming response answers that question anyway.

Regards,
Bert

Unable to delete changelog files after liquibase operation

$
0
0
I am working with liquibase to update database with temp changlog files and delete then after liquibase operation like executeUpdate.
But file delete operation is failing after liquibase operation, stating "File is opened with other process".

Please let me know does liquibase open lock on file and does not release them till process is executed.

Thanks in advance.

Re : Is the Gradle plug-in advised?

Viewing all 1169 articles
Browse latest View live


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