Skip to content

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Aug 27, 2025

About the changes

We want to store impact metrics configuration per flag. Previously we were storing impact metrics in global settings. This new table will accommodate both metrics for a flag and global ones (null feature field).
I decoded to model config as JSONB since we're not going to do any joins and we need to store data of this shape:

{
        id: string;
        selectedSeries: string;
        selectedRange: 'hour' | 'day' | 'week' | 'month';
        beginAtZero: boolean;
        aggregationMode: string;
        selectedLabels: Record<string, string[]>;
        title?: string;
    }

This is basically CRUD for this screen
Screenshot 2025-08-27 at 16 03 03

Important files

Discussion points

Copy link

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Updated (UTC)
unleash-docs Ignored Ignored Preview Aug 27, 2025 2:01pm

Copy link
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

db.runSql(
`
CREATE TABLE IF NOT EXISTS impact_metrics(
id TEXT NOT NULL PRIMARY KEY,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be ulid generated by code

`
CREATE TABLE IF NOT EXISTS impact_metrics(
id TEXT NOT NULL PRIMARY KEY,
feature VARCHAR(255),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be null for global impact metrics

CREATE TABLE IF NOT EXISTS impact_metrics(
id TEXT NOT NULL PRIMARY KEY,
feature VARCHAR(255),
config JSONB NOT NULL,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implicit schema for CRUD config

id TEXT NOT NULL PRIMARY KEY,
feature VARCHAR(255),
config JSONB NOT NULL,
FOREIGN KEY (feature) REFERENCES features(name) ON DELETE CASCADE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if related to feature it has to be a valid feature

@kwasniew kwasniew requested a review from Tymek August 27, 2025 14:30
@github-project-automation github-project-automation bot moved this from New to Approved PRs in Issues and PRs Aug 27, 2025
@kwasniew kwasniew merged commit e9f651e into main Sep 2, 2025
12 of 13 checks passed
@kwasniew kwasniew deleted the impact-metrics-migration branch September 2, 2025 11:40
@github-project-automation github-project-automation bot moved this from Approved PRs to Done in Issues and PRs Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants