Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
[cloud][CLOUD-356] Change default invite quota for users (#33786)
Browse files Browse the repository at this point in the history
* [cloud][CLOUD-356] Change default invite quota for users

Right now the default quota is 15. However we expect cloud open beta
customers to be able to invite ~100 developers in their organization.

Changing the default quota to 100 to adhere to this expected size.
Otherwise we would need more than 1 person to invite the organization
members (or change the quota in the DB directly on-demand), which is not
desired.

* Fix failing unit test

* Fix backcompat check
  • Loading branch information
kopancek authored Apr 13, 2022
1 parent a2f9e22 commit 2f5c36f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions dev/ci/go-backcompat/flakefiles/v3.38.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"path": "enterprise/internal/codemonitors",
"prefix": "TestCodeMonitorHook",
"reason": "Feature is experimental and not enabled for any customers"
},
{
"path": "internal/database",
"prefix": "TestUsers_CheckAndDecrementInviteQuota",
"reason": "Test is written in a bad way (depends on default value definition, but does not affect backwards compatibility) in https://github.com/sourcegraph/sourcegraph/pull/33786."
}
]
2 changes: 1 addition & 1 deletion internal/database/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@ Foreign-key constraints:
created_at | timestamp with time zone | | not null | now()
updated_at | timestamp with time zone | | not null | now()
deleted_at | timestamp with time zone | | |
invite_quota | integer | | not null | 15
invite_quota | integer | | not null | 100
passwd | text | | |
passwd_reset_code | text | | |
passwd_reset_time | timestamp with time zone | | |
Expand Down
2 changes: 1 addition & 1 deletion internal/database/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestUsers_CheckAndDecrementInviteQuota(t *testing.T) {
}
// Check that it's within some reasonable bounds. The upper bound number here can increased
// if we increase the default.
if lo, hi := 0, 15; inviteQuota <= lo || inviteQuota > hi {
if lo, hi := 0, 100; inviteQuota <= lo || inviteQuota > hi {
t.Fatalf("got default user invite quota %d, want in [%d,%d)", inviteQuota, lo, hi)
}

Expand Down
2 changes: 2 additions & 0 deletions migrations/frontend/1649759318/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Undo the changes made in the up migration
ALTER TABLE IF EXISTS users ALTER COLUMN invite_quota SET DEFAULT 15;
2 changes: 2 additions & 0 deletions migrations/frontend/1649759318/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: change_default_invite_quota
parents: [1649269601]
1 change: 1 addition & 0 deletions migrations/frontend/1649759318/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE IF EXISTS users ALTER COLUMN invite_quota SET DEFAULT 100;

0 comments on commit 2f5c36f

Please sign in to comment.