Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

Latest commit

 

History

History
41 lines (34 loc) · 1.58 KB

File metadata and controls

41 lines (34 loc) · 1.58 KB

Migrations

Updating from <5.0.0 to 5.0.0

In order to update the module from previous versions to version 5.0.0, install the newest user module and then perform the following steps:

  1. Run the profile migration graphql query:
mutation {
  records_update_all(sync: false, table: "modules/profile/profile", record: { table: "modules/user/profile" }) {
    count
  }
}

Validate if all records from the modules/profile/profiles table have been properly migrated to modules/user/profiles.

  1. Run the following liquid script to migrate roles from user table to the new profile table:
{% liquid
graphql total = 'modules/user/user/count'
assign count = total.users.total_entries
assign pages = count | divided_by: 1000.0 | ceil

for page in (1..pages)
  graphql r = 'modules/user/user/search', page: page, limit: 1000, include_profiles: true
  for user in r.users.results
    assign roles = user.roles
    assign profile = user.profiles.first

    if profile != null
      assign object = '{}' | parse_json | hash_merge: valid: true, id: profile.id, roles: roles
      function object = 'modules/core/commands/execute', object: object, mutation_name: 'modules/user/profiles/roles/set'
    endif
  endfor
endfor
%}
  1. Remove the profile module and delete the modules/profile/profile table.

  2. Remove roles from user configuration in the app/user.yml file if present.

  3. Update application code to use current profile modules/user/helpers/current_profile instead of user for checking permissions.