aspose file tools*
The moose likes Groovy and the fly likes [Grails] Schema Export Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "[Grails] Schema Export" Watch "[Grails] Schema Export" New topic
Author

[Grails] Schema Export

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

While working on a project we decided we wanted to specify the names of all of our indexes and foreign keys. When we do a grails run-app, assuming the database exists but no tables, everything gets created as expected except our index and key names are not used. They are defaulted to FK1234555465, etc. However, if we execute

grails dev schema-export export

indexes and keys are named properly. Is this a bug or is this expected?

Another side question here is, Ive noticed also that unless you're using HSQLDB, Grails will not create the database for you. You have to drop and create it manually, and then Grails will generate the schema. This is a small issue, but kind of annoying with the extra step. I just figured I'd bring it up in case anyone knows the reason for this.


GenRocket - Experts at Building Test Data
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

on your side question, what DB are you using and at what stage do you want Grails to create the DB for you?


===Vyas Sanzgiri===
My Blog
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Vyas Sanzgiri wrote:on your side question, what DB are you using and at what stage do you want Grails to create the DB for you?


I'm using MySQL and I want the DB created if my dev is set to create/create-drop.
Peter Ledbrook
author
Greenhorn

Joined: Jul 15, 2009
Posts: 25

indexes and keys are named properly. Is this a bug or is this expected?


Do the indexes have the incorrect names in the database? Or is it just the foreign keys? As for the foreign keys, I notice you've raised an issue already. Whatever feature is already there may not be working correctly, but I have to admit I don't know for sure.


Another side question here is, Ive noticed also that unless you're using HSQLDB, Grails will not create the database for you. You have to drop and create it manually, and then Grails will generate the schema. This is a small issue, but kind of annoying with the extra step. I just figured I'd bring it up in case anyone knows the reason for this.


This is due to Hibernate's auto DDL feature. Why does Hibernate not do it? I don't know, but I suspect it's because the database user configured for the application typically shouldn't be allowed to create databases (something that a system/database administrator should be doing).

Cheers,

Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [Grails] Schema Export