0

I have a situation where I'd rather not use the built-in constraints.

We do use the constraints (currently) to drive database schema creation. It seems (from what I've checked thus far) that all the bases are covered if we stop using built-in constraints and move to using the static mapping block instead.

The one exception is the nullable constraint. I don't see a way to mark the column as not nullable in the static mapping block in a way that controls schema generation. Is there a way to do so?

user1373467
  • 315
  • 3
  • 12

1 Answers1

0

I'd think the simplest way to do this (assuming you have database access) would be to use grails schema-exportto generated the relevant DDL and simply add the not-null constraint to the DDL and manually run it on the DB. Just be sure to update your dbCreate in your appropriate DataSource to "validate", otherwise you may end up accidentally clobbering this change.

Aquatoad
  • 778
  • 8
  • 21
  • Well, thanks, that's one possible workaround... but I'm still holding out hope that someone can find a way to do it in the mapping block ;-) – user1373467 May 11 '12 at 13:34