mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
feat: rename toggle to flag with db migration (#7118)
Renaming also permissions with migration
This commit is contained in:
parent
2d519469d4
commit
4824a02f2b
@ -120,7 +120,7 @@ describe('project-access', () => {
|
|||||||
|
|
||||||
cy.get(`[data-testid='CancelIcon']`).last().click();
|
cy.get(`[data-testid='CancelIcon']`).last().click();
|
||||||
cy.get(`[data-testid='${PA_ROLE_ID}']`).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,
|
force: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ const createFeature = async (featureName: string) => {
|
|||||||
.expect(201);
|
.expect(201);
|
||||||
};
|
};
|
||||||
|
|
||||||
const createFeatureToggleWithStrategy = async (featureName: string) => {
|
const createFeatureFlagWithStrategy = async (featureName: string) => {
|
||||||
await createFeature(featureName);
|
await createFeature(featureName);
|
||||||
return app.request
|
return app.request
|
||||||
.post(
|
.post(
|
||||||
@ -309,7 +309,7 @@ test('validate import data', async () => {
|
|||||||
await createFeature(archivedFeature);
|
await createFeature(archivedFeature);
|
||||||
await archiveFeature(archivedFeature);
|
await archiveFeature(archivedFeature);
|
||||||
|
|
||||||
await createFeatureToggleWithStrategy(existingFeature);
|
await createFeatureFlagWithStrategy(existingFeature);
|
||||||
|
|
||||||
await createContextField(contextField);
|
await createContextField(contextField);
|
||||||
const importPayloadWithContextFields: ImportTogglesSchema = {
|
const importPayloadWithContextFields: ImportTogglesSchema = {
|
||||||
@ -372,12 +372,12 @@ test('validate import data', async () => {
|
|||||||
message:
|
message:
|
||||||
'We detected you are missing the following permissions:',
|
'We detected you are missing the following permissions:',
|
||||||
affectedItems: [
|
affectedItems: [
|
||||||
'Create feature toggles',
|
|
||||||
'Update feature toggles',
|
|
||||||
'Create context fields',
|
'Create context fields',
|
||||||
'Create activation strategies',
|
'Create activation strategies',
|
||||||
'Delete activation strategies',
|
'Delete activation strategies',
|
||||||
'Update variants',
|
'Update variants',
|
||||||
|
'Create feature flags',
|
||||||
|
'Update feature flags',
|
||||||
'Create tag types',
|
'Create tag types',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
41
src/migrations/20240523093355-toggle-to-flag-rename.js
Normal file
41
src/migrations/20240523093355-toggle-to-flag-rename.js
Normal 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,
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user