patrycze
patrycze

Reputation: 29

export data from database in liquibase format

is it possible to export data in liquibase format from already exist postgresql database? until today i each time when i run my project in groovy grails i was using bootstrap file where i was generating everything to database. to export schemas i used grails dbm-generate-changelog and works fine. i used configure tutorial from http://grails-plugins.github.io/grails-database-migration/2.0.x/index.html

best regard!!! :-)

Upvotes: 0

Views: 2687

Answers (1)

cfrick
cfrick

Reputation: 37033

You can use a regular SQL Dump from your DB in the liquibase migrations with minor effort:

  1. Create your SQL file and put it under grails-app/migrations. E.g.

    grails-app/migrations/2016-03-17-002-activiti-5.19.0.2.mysql.create.engine.sql
    
  2. Add that file to your changelog.groovy

  3. Add the following preamble to the SQL file

    --liquibase formatted sql
    
  4. Separate your SQL file into sections you want to see as changesets (add at least one at the beginning):

    --changeset activiti:5.19.0.2-create-engine
    

See the docs: http://www.liquibase.org/documentation/sql_format.html

Upvotes: 1

Related Questions