Grails schema-export does a great job of generating the DDL to create database schemas for a particular database. However what I would like to do, is have grails just output the DDL for updates to an already created schema, not the DDL to create it from scratch.
I'm thinking it should be possible, as grails does have the ability to actually update schemas if you specificy dbCreate = "update"
in your datasource.
But I just want grails to spit out what it would run, not actually do it, so I can execute it myself through a SQL tool in a controlled manner.
As @GreyBeardedGeek pointed out in a comment, the Database Migration Plugin (which is included by default now) can generate the "schema diff" that you are looking for, and it does substantially more than what the vanilla dbCreate = "update"
does, since Grails' native db updating relies only on what Hibernate provides, and it's very conservative in the updates it can do.
In particular, the part of the Database Migration plugin that you are looking for is the dbm-update-sql
script, which will give you the SQL that it would run to update the DB to the current schema version.
In general, I would strongly advise using a tool like the Database Migration plugin, since it bundles your DB schema in with your application code and you can easily version them together, and it also includes lots of tooling so that running the updates is much less painful, and allows for rollbacks and custom scripts to massage things as needed.