Alter column issue on Oracle - Need advice

42 views
Skip to first unread message

Shane Walters

unread,
Mar 21, 2013, 5:57:32 PM3/21/13
to fluentmigrato...@googlegroups.com
I have an existing Not Null column and I need to change the length.

Alter.Column("SystemName")
    .OnTable(AlertDefs)
    .AsString(255);

Results in :
ALTER TABLE stAlertDefs MODIFY SystemName NVARCHAR2(255) NOT NULL

This works fine in SqlServer.

Oracle, pig that it is, complains 
!!! ORA-01442: column to be modified to NOT NULL is already NOT NULL
because it's not smart enough to just ignore the NOT NULL and go on about life.

Any ideas on how to handle this?  My thoughts are we should not generate 'Not Null' unless the Alter specifically had .NotNullable().  But if I change Expression.Column.IsNullable to bool?, then it would probably break anyone's existing migrations when they don't have .NotNullable().

I'm fishing for ideas.  I can always use native sql to make this change instead of fluent syntax.

Thanks,

-Shane


Shane Walters

unread,
Mar 21, 2013, 7:37:34 PM3/21/13
to fluentmigrato...@googlegroups.com
I found a way to keep existing functionality for all databases and make Oracle do what it needs to do.  I did have to make the IsNullable a nullable<bool>, but that was a small change.  I'll try to push a commit soon.

-Shane
Reply all
Reply to author
Forward
0 new messages