1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix: add migration to normalize api token types (#7974)

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
This commit is contained in:
Thomas Heartman 2024-08-23 13:29:49 +02:00 committed by GitHub
parent 1f3cc3917e
commit 9af42b3565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
};