"Fossies" - the Fresh Open Source Software Archive

Member "grails-core-5.2.4/grails-docs/src/test/resources/docs/ref/Command Line/schema-export.html" (14 Sep 2022, 60713 Bytes) of package /linux/www/grails-core-5.2.4.tar.gz:

Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the grails-core-5.2.4.tar.gz project site itself.

(Quick Reference)



Uses Hibernate’s SchemaExport tool to generate DDL or export the schema. NOTE: As of Grails 3, the Hibernate plugin is not by default on the build classpath. You need to add it to the build classpath to get the command working.


//Add Hibernate to the build classpath
buildscript {
    dependencies {
        classpath "org.grails.plugins:hibernate:"
grails schema-export
grails schema-export --datasource=lookup
grails prod schema-export
grails dev schema-export
grails prod schema-export export
grails prod schema-export export --datasource=auditing
grails prod schema-export stdout



grails <<environment>> schema-export <<action>> ['stdout'] <<filename>> [--datasource]


  • environment - The environment containing the database configuration to use (dev, prod, etc…​).

  • action - Either 'generate' or 'export'. The default is 'generate'. Specifying 'export' will execute the script against the specified environment’s database instead of just generating the ddl file.

  • stdout - Passing 'stdout' will cause the script to dump the ddl to stdout.

  • filename - The name of the file to write the ddl to. The default is ddl.sql in the project’s 'target' directory.

  • datasource - The DataSource name suffix; defaults to the default DataSource if not specified