MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / tryInsertOrg

Function tryInsertOrg

apps/cloud/src/auth/user-store.ts:41–48  ·  view source on GitHub ↗
(id: string, name: string, slug: string)

Source from the content-addressed store, hash-verified

39 // null when either conflict swallowed the insert — the caller decides whether
40 // to re-read (id race) or retry with a new candidate (slug race).
41 const tryInsertOrg = async (id: string, name: string, slug: string) => {
42 const [row] = await db
43 .insert(organizations)
44 .values({ id, name, slug })
45 .onConflictDoNothing()
46 .returning();
47 return row ?? null;
48 };
49
50 // Every new org row is born with a slug — there is no nullable window and no
51 // self-healing. Existing rows keep their slug (stable across renames, so org

Callers 1

upsertOrganizationFunction · 0.85

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected