carleton/reason_package — pull request #56 by andrew-kzoo (2014-02-20 18:37:32+00:00)
Title: Add ORDER BY clause to fix default order

Add ORDER BY clause to fix MyISAM/InnoDB default order assumption.

When this query is performed with an entity table backed by the InnoDB storage engine records are returned in PRIMARY KEY order (consistent with the logic of the upgrade script). When performed against an entity table backed by the MyISAM engine records are returned in INSERT order (order in which records were originally added to the table).

Different MySQL storage engines are used for different tables in Reason. There is no mention or discussion of this in the Reason documentation. MyISAM and InnoDB behave differently. The Reason 4.4 upgrade script failed (in part) because the storage engine of the entity table wasn't InnoDB. New tables created in MySQL use the default storage engine. MyISAM is the default storage engine prior to MySQL 5.5.5. And, InnoDB is the default storage engine as of MySQL 5.5.5.