mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: update migration bugs (#3589)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> fixes migration syntax bugs ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
a53457f6d0
commit
2960d36664
@ -68,7 +68,7 @@ exports.down = function (db, callback) {
|
|||||||
feature_strategies.parameters as parameters,
|
feature_strategies.parameters as parameters,
|
||||||
feature_strategies.constraints as constraints,
|
feature_strategies.constraints as constraints,
|
||||||
feature_strategies.sort_order as sort_order,
|
feature_strategies.sort_order as sort_order,
|
||||||
fss.segment_id as segments
|
fss.segment_id as segments,
|
||||||
feature_strategies.title as strategy_title
|
feature_strategies.title as strategy_title
|
||||||
FROM
|
FROM
|
||||||
features
|
features
|
||||||
|
@ -4,14 +4,14 @@ exports.up = function (db, callback) {
|
|||||||
db.runSql(
|
db.runSql(
|
||||||
`
|
`
|
||||||
-- delete deprecated strategies still present in v4
|
-- delete deprecated strategies still present in v4
|
||||||
delete from strategies
|
delete from strategies
|
||||||
where name in ('gradualRolloutUserId', 'gradualRolloutRandom', 'gradualRolloutSessionId')
|
where name in ('gradualRolloutUserId', 'gradualRolloutRandom', 'gradualRolloutSessionId')
|
||||||
and deprecated
|
and deprecated
|
||||||
and not exists (select * from feature_strategies where strategy_name = name limit 1);
|
and not exists (select * from feature_strategies where strategy_name = name limit 1);
|
||||||
|
|
||||||
-- deprecate strategies on v5
|
-- deprecate strategies on v5
|
||||||
update strategies set deprecated = true where name in ('userWithId');
|
update strategies set deprecated = true where name in ('userWithId');
|
||||||
|
|
||||||
-- update strategy descriptions and sort order
|
-- update strategy descriptions and sort order
|
||||||
update strategies set sort_order = 1, description = 'This strategy turns on / off for your entire userbase. Prefer using "Gradual rollout" strategy (100%=on, 0%=off).' WHERE name = 'default';
|
update strategies set sort_order = 1, description = 'This strategy turns on / off for your entire userbase. Prefer using "Gradual rollout" strategy (100%=on, 0%=off).' WHERE name = 'default';
|
||||||
update strategies set sort_order = 0 WHERE name = 'flexibleRollout';
|
update strategies set sort_order = 0 WHERE name = 'flexibleRollout';
|
||||||
@ -24,44 +24,45 @@ exports.up = function (db, callback) {
|
|||||||
exports.down = function (db, callback) {
|
exports.down = function (db, callback) {
|
||||||
db.runSql(
|
db.runSql(
|
||||||
`
|
`
|
||||||
-- restore deleted strategies
|
|
||||||
insert into strategies (name, description, parameters, deprecated, sort_order) values
|
-- restore deleted strategies
|
||||||
('gradualRolloutRandom', 'Randomly activate the feature toggle. No stickiness.', [
|
insert into strategies (name, description, parameters, deprecated, sort_order) values
|
||||||
{
|
('gradualRolloutRandom', 'Randomly activate the feature toggle. No stickiness.', '[
|
||||||
"name": "percentage",
|
{
|
||||||
"type": "percentage",
|
"name": "percentage",
|
||||||
"description": "",
|
"type": "percentage",
|
||||||
"required": false
|
"description": "",
|
||||||
}
|
"required": false
|
||||||
], true, 3),
|
}
|
||||||
('gradualRolloutSessionId', 'Gradually activate feature toggle. Stickiness based on session id.', [
|
]', true, 3),
|
||||||
{
|
('gradualRolloutSessionId', 'Gradually activate feature toggle. Stickiness based on session id.', '[
|
||||||
"name": "percentage",
|
{
|
||||||
"type": "percentage",
|
"name": "percentage",
|
||||||
"description": "",
|
"type": "percentage",
|
||||||
"required": false
|
"description": "",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "groupId",
|
||||||
|
"type": "string",
|
||||||
|
"description": "Used to define a activation groups, which allows you to correlate across feature toggles.",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
]', true, 4),
|
||||||
|
('gradualRolloutUserId', 'Gradually activate feature toggle for logged in users. Stickiness based on user id.', '[
|
||||||
|
{
|
||||||
|
"name": "percentage",
|
||||||
|
"type": "percentage",
|
||||||
|
"description": "",
|
||||||
|
"required": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "groupId",
|
"name": "groupId",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Used to define a activation groups, which allows you to correlate across feature toggles.",
|
"description": "Used to define a activation groups, which allows you to correlate across feature toggles.",
|
||||||
"required": true
|
"required": true
|
||||||
}
|
}
|
||||||
], true, 4),
|
]', true, 5);
|
||||||
('gradualRolloutUserId', 'Gradually activate feature toggle for logged in users. Stickiness based on user id.', [
|
|
||||||
{
|
|
||||||
"name": "percentage",
|
|
||||||
"type": "percentage",
|
|
||||||
"description": "",
|
|
||||||
"required": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "groupId",
|
|
||||||
"type": "string",
|
|
||||||
"description": "Used to define a activation groups, which allows you to correlate across feature toggles.",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
], true, 5);
|
|
||||||
|
|
||||||
-- revert sort order
|
-- revert sort order
|
||||||
update strategies set sort_order = 0 WHERE name = 'default';
|
update strategies set sort_order = 0 WHERE name = 'default';
|
||||||
|
Loading…
Reference in New Issue
Block a user