Browse Source

Quote reserved `groups` identifier in MySQL collection-permissions migration

`groups` is a reserved keyword in MySQL 8, so the unquoted `INNER JOIN groups`
in the second UPDATE of the MySQL variant of
2026-07-16-120000_add_custom_collection_permissions/up.sql fails with
ERROR 1064 (syntax error), aborting the migration and preventing the server
from starting on MySQL/MariaDB. Backtick the table references, matching the
existing 2022-07-27-110000_add_group_support migration. PostgreSQL and SQLite
do not reserve the word and are unchanged.
pull/7397/head
tom27052006 14 hours ago
parent
commit
2243922517
  1. 8
      migrations/mysql/2026-07-16-120000_add_custom_collection_permissions/up.sql

8
migrations/mysql/2026-07-16-120000_add_custom_collection_permissions/up.sql

@ -20,8 +20,10 @@ WHERE atype = 4
AND EXISTS (
SELECT 1
FROM groups_users
INNER JOIN groups ON groups.uuid = groups_users.groups_uuid
-- `groups` is a reserved word in MySQL 8 and must be quoted, matching the existing
-- `2022-07-27-110000_add_group_support` migration. (PostgreSQL/SQLite do not reserve it.)
INNER JOIN `groups` ON `groups`.uuid = groups_users.groups_uuid
WHERE groups_users.users_organizations_uuid = users_organizations.uuid
AND groups.organizations_uuid = users_organizations.org_uuid
AND groups.access_all = TRUE
AND `groups`.organizations_uuid = users_organizations.org_uuid
AND `groups`.access_all = TRUE
);

Loading…
Cancel
Save