How to generate DDL script for domain classes in Grails using schema-export target « Intelligrape Groovy & Grails Blogs

How to generate DDL script for domain classes in Grails using schema-export target

Posted by Deepak Mittal

On most of my grails projects, I am used to let grails handle database schema creation for me. However, there is a project where the database is shared between multiple applications. In that project, we have to check-in our table creation/modification script as a SQL file, which is later executed by a DBA.

I use a not-so-commonly known Grails command/script schema-export to help me deal me with this situation without much fuss of writing the DDL script myself.

To generate DDL script for all the domain classes

> grails schema-export

The DDL script in this case is created as {PROJECT_ROOT}/target/ddl.sql file.

You can also specify the path of the file where you want the schema file to get generated.

> grails schema-export sql/ddl.sql

Hope this helps!

-Deepak

  • Share/Bookmark
This entry was posted on July 15th, 2010 at 12:54 am and is filed under Database, Grails . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

5 Responses to “How to generate DDL script for domain classes in Grails using schema-export target”

  1. Jay Chandran says:

    Thanks for that. Never knew it before!

  2. coupon says:

    Important?…

    Is this really updated?…

  3. One Hr Cash Loans…

    [...]How to generate DDL script for domain classes in Grails using schema-export target « Intelligrape Groovy & Grails Blogs[...]…

  4. leak says:

    leak…

    [...]How to generate DDL script for domain classes in Grails using schema-export target « Intelligrape Groovy & Grails Blogs[...]…

  5. vouchers says:

    vouchers…

    [...]How to generate DDL script for domain classes in Grails using schema-export target « Intelligrape Groovy & Grails Blogs[...]…

Leave a Reply