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

15 / Jul / 2010 by Deepak Mittal 9 comments

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!



comments (9)

  1. Read more

    Hey! Do you use Twitter? I’d like to follow you if that would be
    ok. I’m definitely enjoying your blog and look forward to new posts.


    Great blog you have here but I was wanting to know if you knew of
    any message boards that cover the same topics discussed here?
    I’d really love to be a part of online community where I can get feedback from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know. Thank you!

  3. ダイアンフォンファステンバーグ ワンピース

    Oh my goodness! Awesome article dude! Thank you so much, However
    I am encountering issues with your RSS. I don’t know why I can’t join it.
    Is there anyone else getting the same RSS problems? Anyone who knows the solution can you kindly respond?


  4. Esisa.Es

    It is important to give your Roberto Cavalli sunglasses good care at
    all times. And the family has nice dishes, safe
    and stylish dishes to eat off. Contact us right away if you have a restaurant, hotel, catering company, party planner
    business, party rental business or a cafeteria.

  5. Susie

    Another great idea when looking at Women’s Luxury Watches is the Citizen Women’s Eco-Drive Serano Sport Diamond Accent Watch.
    This type of jewelry has a wide array of prices to
    choose from. Thankfully there are watch companies out there
    catering to everyone’s budget.


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

  7. Krysten Zide

    After I originally left a comment I appear to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive four emails with the same comment. Is there a means you can remove me from that service? Kudos!


Leave a Reply

Your email address will not be published. Required fields are marked *