liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
200 stars 59 forks source link

How to specify --difftypes #13

Closed fsparv closed 7 years ago

fsparv commented 8 years ago

I want to get started on an existing DB, which has been built from existing sql scripts to contain only the initial data. I ran generateChangelog and got an acceptable xml change log for the DDL including pirmary keys and foreign keys etc. However, none of the data was included. http://forum.liquibase.org/topic/difftypes-questions and other stuff out there seems to suggest I need to add "data" to the --difftypes option... but I can't find any documentation of how to specify this either here, or in the example workshop.

stevesaliman commented 8 years ago

You should be able to use any Liquibase parameter starting with -- by simply including it in an action block. In your case something like the following should do the trick:

liquibase {
  activities {
    main {
      changeLogFile 'src/main/db/main.groovy'
      url project.ext.jdbcUrl
      username project.ext.jdbcUsername
      password project.ext.jdbcPassword
      diffTypes 'data'
    }
  }
}
fsparv commented 8 years ago

Ah I see where this is documented. Thanks for your patience. Another example in the usage section perhaps to highlight this mapping to -- parameters? I was low on patience and scanned past it in the 3 paragraphs of solid text because I didn't know I was looking for an answer provided by generalized feature. I was looking for (and doing find in page for) "diff" and "difftype" Technically the examples are doing that but things like url, username and password are so ubiquitously required for database stuff it wasn't obvious (to me at least) that this was actually mapping to the command line params.

stevesaliman commented 7 years ago

I tried to clarify this a bit. I attempted to make the README a little more clear without having to re-document all the options that Liquibase supports, especially since this list could change over time.

TechGamer0 commented 5 years ago

Hi I tried adding diffTypes 'data' in the liquibase activity block, but it says unknown paramater. And also how can I add tablespace for databasechangelog generated using diffChangeLog. Appreciate any help. Thanks in advance

stevesaliman commented 5 years ago

I had a typo in the original comment above regarding diffTypes - case counts. I've fixed that comment, and if you have it specified with a capital T, it should run.

As for tablespaces, I'm not sure how Liquibase decided what to do with tablespaces, but since it only applies to certain database types, I wouldn't be too surprised if Liquibase didn't support it. You might try asking that question in the Liquibase forums. Whatever it supports, the plugin supports.

I'm sorry it took so long to respond to the question,

Steve