SchemaUpdate (unlike SchemaExport) is designed to be 'conservative' in the updates it tries to apply to your database as it inspects the mapping files in order to try to ensure the greatest chance of it being successful. Since NOT NULL is a constraint that quite often fails when applied to existing tables (for obvious reasons) SchemaUpdate elects not to apply this constraint. AFAIK, there isn't an argument you can pass to SchemaUpdate that says "I know what I'm doing and have either disabled constraints (as you have done) or have ensured that all data satisfies all of the constraints in the mapping file so please apply everything since I'm a grownup and can take whatever happens next." :)
If you'd like an override behavior of SchemaUpdate that would permit you to do this, then please open a JIRA issue for it and we can consider it. "Strict Mode" for SchemaUpdate is an interesting idea probably worth at least considering... Steve Bohlen [email protected] http://blog.unhandled-exceptions.com http://twitter.com/sbohlen On Mon, Jun 20, 2011 at 1:48 PM, Matteo Migliore <[email protected]>wrote: > The problem is that I need the update with the alter of each column to add > with "not null" constraint > if the mapping specify this. > > > > On Mon, Jun 20, 2011 at 6:48 PM, Ayende Rahien <[email protected]> wrote: > >> 5. There is a null value there, what is going on now? >> >> >> On Mon, Jun 20, 2011 at 5:41 PM, Matteo Migliore < >> [email protected]> wrote: >> >>> Hi! >>> >>> I would use SchemaUpdate to launch migration scripts but is known that >>> the null constraint is "turned off". >>> >>> How is possible to apply a "strict" version of the update script? >>> I've a mechanism to fill with valid data the not nullable columns so my >>> steps should be: >>> 1. disable all DB constraints >>> 2. launch the create/alter scripts >>> 3. launch my "data filler" >>> 4. enable all DB constraints >>> >>> Thanks! >> >> >> >
