mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
This commit changes the features-tables:
- drop columns 'strategy' and 'parameters'
- add column 'strategies' of type json.
- migrates existing strategy-mappings in to the new format.
The idea is that the 'strategies' column should contain a json-array
of strategy-configuration for the toggle:
```
[{
"name" : "strategy1",
"parameters": { "name": "vale" }
}]
```
To make sure to not break exiting clients the api is extended with a
mapping layer (adding old fields to the json-respons, and mapping
to the new format on create/update a feature toggle.
this commit is first step in solving #102
13 lines
396 B
SQL
13 lines
396 B
SQL
--create new strategies-column
|
|
ALTER TABLE features ADD "strategies" json;
|
|
|
|
--populate the strategies column
|
|
UPDATE features
|
|
SET strategies = ('[{"name":"'||f.strategy_name||'","parameters":'||f.parameters||'}]')::json
|
|
FROM features as f
|
|
WHERE f.name = features.name;
|
|
|
|
--delete old strategy-columns
|
|
ALTER TABLE features DROP COLUMN "strategy_name";
|
|
ALTER TABLE features DROP COLUMN "parameters";
|