Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: last seen in feature environment (#4391)
- Adds last_seen_at column in feature_environments and lastSeenAt property to the FeatureEnvironment models Closes [1-1181](https://linear.app/unleash/issue/1-1181/implement-storing-last-seen-per-environment-be) --------- Signed-off-by: andreas-unleash <andreas@getunleash.ai>
- Loading branch information
1 parent
76dc890
commit d21ccb7
Showing
14 changed files
with
229 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
src/migrations/20230802141830-add-feature-and-environment-last-seen-at-to-features-view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
'use strict'; | ||
|
||
exports.up = function (db, callback) { | ||
db.runSql( | ||
` | ||
ALTER TABLE feature_environments ADD COLUMN IF NOT EXISTS last_seen_at timestamp with time zone; | ||
DROP VIEW features_view; | ||
CREATE VIEW features_view AS | ||
SELECT | ||
features.name as name, | ||
features.description as description, | ||
features.type as type, | ||
features.project as project, | ||
features.stale as stale, | ||
features.impression_data as impression_data, | ||
features.created_at as created_at, | ||
features.archived_at as archived_at, | ||
features.last_seen_at as last_seen_at, | ||
feature_environments.last_seen_at as env_last_seen_at, | ||
feature_environments.enabled as enabled, | ||
feature_environments.environment as environment, | ||
feature_environments.variants as variants, | ||
environments.name as environment_name, | ||
environments.type as environment_type, | ||
environments.sort_order as environment_sort_order, | ||
feature_strategies.id as strategy_id, | ||
feature_strategies.strategy_name as strategy_name, | ||
feature_strategies.parameters as parameters, | ||
feature_strategies.constraints as constraints, | ||
feature_strategies.sort_order as sort_order, | ||
fss.segment_id as segments, | ||
feature_strategies.title as strategy_title, | ||
feature_strategies.disabled as strategy_disabled, | ||
feature_strategies.variants as strategy_variants | ||
FROM | ||
features | ||
LEFT JOIN feature_environments ON feature_environments.feature_name = features.name | ||
LEFT JOIN feature_strategies ON feature_strategies.feature_name = feature_environments.feature_name | ||
and feature_strategies.environment = feature_environments.environment | ||
LEFT JOIN environments ON feature_environments.environment = environments.name | ||
LEFT JOIN feature_strategy_segment as fss ON fss.feature_strategy_id = feature_strategies.id; | ||
`, | ||
callback, | ||
); | ||
}; | ||
|
||
exports.down = function (db, callback) { | ||
db.runSql( | ||
` | ||
DROP VIEW features_view; | ||
CREATE VIEW features_view AS | ||
SELECT | ||
features.name as name, | ||
features.description as description, | ||
features.type as type, | ||
features.project as project, | ||
features.stale as stale, | ||
features.impression_data as impression_data, | ||
features.created_at as created_at, | ||
features.archived_at as archived_at, | ||
feature_environments.last_seen_at as last_seen_at, | ||
feature_environments.enabled as enabled, | ||
feature_environments.environment as environment, | ||
feature_environments.variants as variants, | ||
environments.name as environment_name, | ||
environments.type as environment_type, | ||
environments.sort_order as environment_sort_order, | ||
feature_strategies.id as strategy_id, | ||
feature_strategies.strategy_name as strategy_name, | ||
feature_strategies.parameters as parameters, | ||
feature_strategies.constraints as constraints, | ||
feature_strategies.sort_order as sort_order, | ||
fss.segment_id as segments, | ||
feature_strategies.title as strategy_title, | ||
feature_strategies.disabled as strategy_disabled, | ||
feature_strategies.variants as strategy_variants | ||
FROM | ||
features | ||
LEFT JOIN feature_environments ON feature_environments.feature_name = features.name | ||
LEFT JOIN feature_strategies ON feature_strategies.feature_name = feature_environments.feature_name | ||
and feature_strategies.environment = feature_environments.environment | ||
LEFT JOIN environments ON feature_environments.environment = environments.name | ||
LEFT JOIN feature_strategy_segment as fss ON fss.feature_strategy_id = feature_strategies.id; | ||
`, | ||
callback, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.