bgarrels / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

SQL Field definitions are wrong: does not run on default >= MySQL 5.6 distributions #410

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
All fields must either:

* Have default value
* Or set as NULL

Currently Textpattern is abusing:

> If strict mode is not enabled, MySQL sets the column to the implicit default 
value for the column data type.

Original issue reported on code.google.com by jukka.m.svahn on 10 Apr 2014 at 9:39

GoogleCodeExporter commented 9 years ago
PS. MySQL 5.6 (and newer) ships with STRICT_TRANS_TABLES enabled by default, 
and thus Textpattern will not be able to run on default distributions.

Original comment by jukka.m.svahn on 10 Apr 2014 at 9:46

GoogleCodeExporter commented 9 years ago

Original comment by jukka.m.svahn on 10 Apr 2014 at 9:47

GoogleCodeExporter commented 9 years ago
Any takers? I can take it, but writing the update queries is easy (and maybe 
educative), so want to do some easy-peasy-lemon-easy work?

Original comment by jukka.m.svahn on 10 Apr 2014 at 9:51

GoogleCodeExporter commented 9 years ago
PS. setup file also needs to be updated (because of updates).

Original comment by jukka.m.svahn on 10 Apr 2014 at 9:52

GoogleCodeExporter commented 9 years ago
> writing the update queries is easy (and maybe educative)

'Cc:' was set in-coincidentally with this comment, I assume?

Original comment by r.wetzlmayr on 10 Apr 2014 at 10:01

GoogleCodeExporter commented 9 years ago
Just asking if someone wants to take this :) Stef has said he doesn't have much 
of an experience about RDBMS, so letting him to do simpler tasks relating to 
SQL might be helpful to get some experience that doesn't involve following 
Textpattern's old and screwed practices.

I can do it, but I won't learn anything new from it.

Original comment by jukka.m.svahn on 10 Apr 2014 at 10:54

GoogleCodeExporter commented 9 years ago
Sure, I'll take this one. Just grunt work to comb through the setup file and 
updates folder for any 'create table' definitions without defaults/null, and 
safe_alter()ing them.

Presumably, this should be done in the _to_4.5.6.php file on the 4.5 branch 
since we don't have a 4.6 drop date yet...

Original comment by stefdawson on 10 Apr 2014 at 11:21

GoogleCodeExporter commented 9 years ago
> Sure, I'll take this one. Just grunt work to comb through the setup file and 
updates folder for any 'create table' definitions without defaults/null, and 
safe_alter()ing them.

Exactly. It needs to be done twice so that it applies to both new installation 
and updates, and that neither dies in between.

In standard SQL create definitions SHOULD default to NULL. Meaning, basically 
in setup.php:

* remove any NOT NULL.
* add default to fields that are memory-mappable (varchar 255 and lower) if any 
are missing

> Presumably, this should be done in the _to_4.5.6.php file on the 4.5 branch 
since we don't have a 4.6 drop date yet...

Yes, this is a bug fix.

Original comment by jukka.m.svahn on 10 Apr 2014 at 11:38

GoogleCodeExporter commented 9 years ago

Original comment by jukka.m.svahn on 10 Apr 2014 at 11:39