jastrachan | 2 Jul 16:45 2005
Picon

Re: grails: database schema creation

Agreed. I'd love these options...

* create any new tables, or add any new indices/columns on startup if  
required. (e.g. if you upgrade the software & run it against an old DB).

* be able to check on startup that the database is correct and fail  
in a nice error message way to indicate why the app can't be run.  
(e.g. 'cannot run on this database as the Cheese table is missing')

* be able to create the DDL script for any new tables/columns/indices  
that need to be created by running a simple script. This is important  
in many database environments - often the DBA will not let you create/ 
modify tables - however you can supply the DDL script to the DBA and  
they can review & apply it

All in all, these are the same bit of code (figuring out the delta  
between the model and the DB); its just a question of how that  
delta / DDL is processed.

On 1 Jul 2005, at 13:25, Guillaume Laforge wrote:

>> btw, I think creating the database should be an ant task rather than
>> creating it at run-time.
>>
>
> Hmmm... we could perhaps create the model at run-time if it doesn't  
> exist?
> Of course, the first time you run your app, it will probably be slow,
> but that's not really critical since you don't often change your
> schema.
> I think DllUtils might perhaps even manage to "update" the schema if
> it changes (not too drastically). But I have to double check if I'm
> right there...
>
> The idea for doing this (creating the DB at run-time) may make sense
> if we want to be totally dynamic and not template-driven like RoR.
>
> -- 
> Guillaume Laforge
> http://glaforge.free.fr/weblog/?catid=2
>

James
-------
http://radio.weblogs.com/0112098/


Gmane