-- Restore the system flag on the tenant grant tables. ALTER TABLE user_grants ADD COLUMN system INTEGER NOT NULL DEFAULT 0; ALTER TABLE group_grants ADD COLUMN system INTEGER NOT NULL DEFAULT 0; ALTER TABLE bot_grants ADD COLUMN system INTEGER NOT NULL DEFAULT 0; -- Fold system grants back into user_grants, anchored to the principal's personal -- tenant (tenant id == user id), which is where they lived before. INSERT INTO user_grants (tenant, user, role, path, system) SELECT principal, principal, role, '', 1 FROM system_grants; DROP TABLE system_grants;