1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-14 20:06:41 +02:00

feat: rename toggle to flag with db migration (#7118)

Renaming also permissions with migration
This commit is contained in:
Jaanus Sellin 2024-05-23 10:17:02 +03:00 committed by GitHub
parent 2d519469d4
commit 4824a02f2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 5 deletions

View File

@ -120,7 +120,7 @@ describe('project-access', () => {
cy.get(`[data-testid='CancelIcon']`).last().click();
cy.get(`[data-testid='${PA_ROLE_ID}']`).click();
cy.contains('update feature toggles within a project').click({
cy.contains('update feature flags within a project').click({
force: true,
});

View File

@ -55,7 +55,7 @@ const createFeature = async (featureName: string) => {
.expect(201);
};
const createFeatureToggleWithStrategy = async (featureName: string) => {
const createFeatureFlagWithStrategy = async (featureName: string) => {
await createFeature(featureName);
return app.request
.post(
@ -309,7 +309,7 @@ test('validate import data', async () => {
await createFeature(archivedFeature);
await archiveFeature(archivedFeature);
await createFeatureToggleWithStrategy(existingFeature);
await createFeatureFlagWithStrategy(existingFeature);
await createContextField(contextField);
const importPayloadWithContextFields: ImportTogglesSchema = {
@ -372,12 +372,12 @@ test('validate import data', async () => {
message:
'We detected you are missing the following permissions:',
affectedItems: [
'Create feature toggles',
'Update feature toggles',
'Create context fields',
'Create activation strategies',
'Delete activation strategies',
'Update variants',
'Create feature flags',
'Update feature flags',
'Create tag types',
],
},

View File

@ -0,0 +1,41 @@
exports.up = function (db, cb) {
db.runSql(`
UPDATE permissions SET display_name = 'Create feature flags' WHERE permission = 'CREATE_FEATURE' AND type = 'project';
UPDATE permissions SET display_name = 'Update feature flags' WHERE permission = 'UPDATE_FEATURE' AND type = 'project';
UPDATE permissions SET display_name = 'Delete feature flags' WHERE permission = 'DELETE_FEATURE' AND type = 'project';
UPDATE permissions SET display_name = 'Change feature flag project' WHERE permission = 'MOVE_FEATURE_TOGGLE' AND type = 'project';
UPDATE permissions SET display_name = 'Enable/disable flags' WHERE permission = 'UPDATE_FEATURE_ENVIRONMENT' AND type = 'environment';
`, cb);
};
exports.down = function (db, cb) {
db.runSql(
`
UPDATE permissions
SET display_name = 'Create feature toggles'
WHERE permission = 'CREATE_FEATURE'
AND type = 'project';
UPDATE permissions
SET display_name = 'Update feature toggles'
WHERE permission = 'UPDATE_FEATURE'
AND type = 'project';
UPDATE permissions
SET display_name = 'Delete feature toggles'
WHERE permission = 'DELETE_FEATURE'
AND type = 'project';
UPDATE permissions
SET display_name = 'Change feature toggle project'
WHERE permission = 'MOVE_FEATURE_TOGGLE'
AND type = 'project';
UPDATE permissions
SET display_name = 'Enable/disable toggles'
WHERE permission = 'UPDATE_FEATURE_ENVIRONMENT'
AND type = 'environment';
`,
cb,
);
};