You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been on a wild goose chase this morning because there was a period of time that my migrations have changed behaviour on allow null by default for columns, twice in 6 months, so I have a long period where my columns are NOT NULL, a 6 month period where they became allow NULL, recently moving back to NOT NULL.
The behavior for null was changed in 0.13.0 which hopefully clarifies behavior:
set column null by default unless identity by @MasterOdin in #1872. Previously columns were created as NOT NULL by default, and to now get that behavior, you will need to explicitly pass 'null' => false in the column options.
Ideally we'd be able to do the simple "always default to false", but need to put in the bit about identity which inverses the default if enabled which is annoying to describe tersely.
I've been on a wild goose chase this morning because there was a period of time that my migrations have changed behaviour on
allow null by default
for columns, twice in 6 months, so I have a long period where my columns are NOT NULL, a 6 month period where they became allow NULL, recently moving back to NOT NULL.If we take the above code as an example. According to the documentation, the
user_uuid
column should allow nulls.My understanding however has been that to allow
null
you would have to explicitly write->addColumn('user_uuid', 'uuid', ['null' => true])
There have been some changes to Phinx to change this behaviour recently, it appears it may have changed a few times in the past too.
The docs need updating because it currently reads:
allow NULL values, defaults to false if identity option is set to true, else defaults to true
which is untrue as of 0.13.4
I'm not sure what this should read, because I don't know if it's as simple as.
allow NULL values, defaults to false
Can someone with a more in depth understanding of how Phinx works update the docs to reflect it's current effect of 'default'.
The text was updated successfully, but these errors were encountered: