-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add feature flag tables #10184
Conversation
Hey @Dschoordsch, would you mind reviewing just the migration in this PR? And not the rest of the code. That's the building block for the rest of this refactor. My plan:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few smaller things, looks good otherwise.
await pg.schema | ||
.createIndex('idx_feature_flag_owner_user') | ||
.on('FeatureFlagOwner') | ||
.columns(['userId', 'featureFlagId']) | ||
.execute() | ||
|
||
await pg.schema | ||
.createIndex('idx_feature_flag_owner_team') | ||
.on('FeatureFlagOwner') | ||
.columns(['teamId', 'featureFlagId']) | ||
.execute() | ||
|
||
await pg.schema | ||
.createIndex('idx_feature_flag_owner_org') | ||
.on('FeatureFlagOwner') | ||
.columns(['orgId', 'featureFlagId']) | ||
.execute() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 I don't see how we would use these indexes.
I think what we want though is the same set of columns ['userId', 'featureFlagId']
, ... as unique constraints. Thanks to Matt I just learned that Postgres is treating null
values as distinct by default1
Footnotes
packages/server/postgres/migrations/1724949259979_addFeatureFlagTables.ts
Outdated
Show resolved
Hide resolved
packages/server/postgres/migrations/1724949259979_addFeatureFlagTables.ts
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,16 @@ | |||
type FeatureFlagNew { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from my learnings with NewMeeting
, adding New to an entity can suck later on. I did a search & it looks like FeatureFlag
is available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added FeatureFlagNew
as a temporary name to minimise conflicts with the old FeatureFlag
. Sorry, I should have added a comment to clarify that. It's FeatureFlag
in the subsequent PR.
await pg.schema | ||
.createTable('FeatureFlag') | ||
.ifNotExists() | ||
.addColumn('id', 'uuid', (col) => col.primaryKey().defaultTo(sql`gen_random_uuid()`)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 why a UUID instead of a serial?
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR will be delayed and might be rejected due to its size. |
Related issue: #10099
This PR was the first in a series of PRs. I've merged all child PRs into this one.
It includes:
noAISummary
. This is now only scoped to the Org rather than the Org and User