apeisa / UserGroups

Adds users groups and page based permission to ProcessWire
GNU General Public License v2.0
11 stars 4 forks source link

InnoDB support / field_inherit_access #46

Open BitPoet opened 8 years ago

BitPoet commented 8 years ago

When choosing InnoDB as storage engine and with the default setting for STRICT_TRANS_TABLES in MySQL >= 5.6 enabled, the insert statement in UserGroupsHooks::rebuild fails (thus failing to install) with

Error Code: 1364. Field 'sort' doesn't have a default value

since sort is defined as NOT NULL. The error can be avoided by setting the sort field to 0 in the insert.

            $sql = "INSERT INTO field_inherit_access (pages_id, data, sort) VALUES ";
            foreach ($insertions as $id => $access_page_id) {
                $id = (int) $id;
                $access_page_id = (int) $access_page_id;
                $sql .= "($id, $access_page_id, 0),";
            }