v8.2.18
This release adds a required name field to API tokens, replacing the description field introduced in v8.2.14.
Breaking Changes
API Token description Replaced by Required name
API tokens now have a required name field (string, max 100 characters) to identify what each token is used for. This replaces the description field introduced in v8.2.14 — the cm_admin:add_description_to_api_token generator has been removed, so run the name generator below even if you already generated the description migration.
The index page lists name as the first column and adds a search-by-name filter. A new Edit page lets users rename a token; the token value and other fields stay read-only.
Migration Steps
- Run the Add Name to API Token generator, then migrate:
rails generate cm_admin:add_name_to_api_token
rails db:migrate
The generated migration:
- Adds a
namestring column toapi_tokens(skipped if the column already exists). - Backfills existing records with
'Unnamed Token'. - Drops the
descriptioncolumn if it exists — this cleans up apps that ran v8.2.14'sadd_description_to_api_tokengenerator.
Existing description values are not carried over to name. If you ran the v8.2.14 generator and want to keep the descriptions, copy them across in the generated migration before remove_column runs, for example:
execute "UPDATE api_tokens SET name = description WHERE name IS NULL"
- Pass a
namewherever your application createsApiTokenrecords directly.ApiTokenvalidatesnamepresence (and a 100-character limit) for every token type, soApiToken.create(...)calls that worked before now fail validation without one. The admin form already requires a name.
Checklist
- Run
rails generate cm_admin:add_name_to_api_token && rails db:migrate(skipadd_description_to_api_token— it has been removed). - Set a
namein any code that createsApiTokenrecords directly.