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

View File

@ -77,6 +77,17 @@ func New() database.Store {
locks: map[int64]struct{}{},
},
}
// Always start with a default org. Matching migration 198.
_, err := q.InsertOrganization(context.Background(), database.InsertOrganizationParams{
ID: uuid.New(),
Name: "first-organization",
Description: "Builtin default organization.",
CreatedAt: dbtime.Now(),
UpdatedAt: dbtime.Now(),
})
if err != nil {
panic(fmt.Errorf("failed to create default organization: %w", err))
}
q.defaultProxyDisplayName = "Default"
q.defaultProxyIconURL = "/emojis/1f3e1.png"
return q