Skip to content

Commit

Permalink
fix: add migration to normalize api token types (#7974)
Browse files Browse the repository at this point in the history
Adds a migration to normalize api token types already in the database,
to remove any weird casing issues as currently demonstrated on sandbox


![image](https://github.com/user-attachments/assets/ad14db22-114d-4de2-b952-722df9ae84a4)

This is a companion piece to #7972
  • Loading branch information
thomasheartman authored Aug 23, 2024
1 parent 1f3cc39 commit 9af42b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/migrations/20240823091442-normalize-token-types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

exports.up = function (db, cb) {
db.runSql(
`
UPDATE api_tokens
SET type = 'client'
WHERE type = 'CLIENT';
UPDATE api_tokens
SET type = 'admin'
WHERE type = 'ADMIN';
UPDATE api_tokens
SET type = 'frontend'
WHERE type = 'FRONTEND';
`,
cb,
);
};

exports.down = function (db, cb) {
db.runSql(``, cb);
};

0 comments on commit 9af42b3

Please sign in to comment.