chore: ensure default org always exists (#12412)

* chore: ensure default org always exists

First user just joins the org created by the migration
This commit is contained in:
Steven Masley
2024-03-05 14:06:35 -06:00
committed by GitHub
parent bc30c9c013
commit 17c486c5e6
9 changed files with 71 additions and 32 deletions
+3 -12
View File
@@ -506,20 +506,11 @@ func TestDefaultOrg(t *testing.T) {
db := database.New(sqlDB)
ctx := context.Background()
// Should start with 0 orgs
// Should start with the default org
all, err := db.GetOrganizations(ctx)
require.NoError(t, err)
require.Len(t, all, 0)
org, err := db.InsertOrganization(ctx, database.InsertOrganizationParams{
ID: uuid.New(),
Name: "default",
Description: "",
CreatedAt: dbtime.Now(),
UpdatedAt: dbtime.Now(),
})
require.NoError(t, err)
require.True(t, org.IsDefault, "first org should always be default")
require.Len(t, all, 1)
require.True(t, all[0].IsDefault, "first org should always be default")
}
type tvArgs struct {