• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Schema manager & nullable columns

Xon

Well-known member
#1
When using the schema manager calling setDefault(null) on a column does not make a column nullable.

I don't feel it makes much sense that if there is an explicit call to set the default as nullable, the column stays non-nullable
 

Chris D

XenForo developer
Staff member
#2
Although perhaps not an unreasonable suggestion, would it not be clearer and shorter to just forget setting a default value, and just set nullable yourself? If no other default value is set, the default value is set to NULL for a nullable column in the Schema Manager.
 

Xon

Well-known member
#3
I'm ok with that, but in that case shouldn't setDefault(null) on a non-nullable column throw a logic exception?

Sure, the schema manager silently ignores it; but being explicit about your SQL schema types is good.