Skip to content

Commit 03808a0

Browse files
committed
docs(database): add the corsair_connect_requests table
Document the connect-request table across the SQLite, Postgres, Drizzle, and Prisma migrations and the core-tables reference.
1 parent c53d44d commit 03808a0

2 files changed

Lines changed: 43 additions & 5 deletions

File tree

docs/concepts/database.mdx

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Database
3-
description: Five tables, always-fresh integration data, tenant-scoped by default.
3+
description: Six tables, always-fresh integration data, tenant-scoped by default.
44
---
55

66
import { WindowsMigrationNote } from '/snippets/windows-shell.mdx';
@@ -145,6 +145,13 @@ CREATE TABLE IF NOT EXISTS corsair_permissions (
145145
expires_at TEXT NOT NULL,
146146
error TEXT
147147
);
148+
149+
CREATE TABLE IF NOT EXISTS corsair_connect_requests (
150+
tenant_id TEXT PRIMARY KEY,
151+
plugin TEXT NOT NULL,
152+
connect_url TEXT NOT NULL,
153+
requested_at TEXT NOT NULL
154+
);
148155
```
149156

150157
</Accordion>
@@ -232,6 +239,13 @@ CREATE TABLE IF NOT EXISTS corsair_permissions (
232239
expires_at TEXT NOT NULL,
233240
error TEXT
234241
);
242+
243+
CREATE TABLE IF NOT EXISTS corsair_connect_requests (
244+
tenant_id TEXT PRIMARY KEY,
245+
plugin TEXT NOT NULL,
246+
connect_url TEXT NOT NULL,
247+
requested_at TEXT NOT NULL
248+
);
235249
```
236250

237251
</Accordion>
@@ -318,6 +332,13 @@ export const corsairPermissions = pgTable('corsair_permissions', {
318332
expiresAt: text('expires_at').notNull(),
319333
error: text('error'),
320334
});
335+
336+
export const corsairConnectRequests = pgTable('corsair_connect_requests', {
337+
tenantId: text('tenant_id').primaryKey(),
338+
plugin: text('plugin').notNull(),
339+
connectUrl: text('connect_url').notNull(),
340+
requestedAt: text('requested_at').notNull(),
341+
});
321342
```
322343

323344
</Accordion>
@@ -405,6 +426,15 @@ model CorsairPermission {
405426
406427
@@map("corsair_permissions")
407428
}
429+
430+
model CorsairConnectRequest {
431+
tenantId String @id @map("tenant_id")
432+
plugin String
433+
connectUrl String @map("connect_url")
434+
requestedAt String @map("requested_at")
435+
436+
@@map("corsair_connect_requests")
437+
}
408438
```
409439

410440
</Accordion>
@@ -449,7 +479,7 @@ Use `*.api.*` to write or force a fresh read. Use `*.db.*` for lists, search, an
449479

450480
## Core tables
451481

452-
Five tables for every integration. Slack, GitHub, Linear, and the rest all share the same schema.
482+
Six tables. The first five are shared by every integrationSlack, GitHub, Linear, and the rest use the same schema. `corsair_connect_requests` records a tenant's pending connect prompt.
453483

454484
| Table | Purpose |
455485
|-------|---------|
@@ -458,6 +488,7 @@ Five tables for every integration. Slack, GitHub, Linear, and the rest all share
458488
| `corsair_entities` | Synced resources like messages, channels, issues, repos (`entity_id`, `entity_type`, `data`) |
459489
| `corsair_events` | Audit log of API calls and webhooks |
460490
| `corsair_permissions` | Approval queue for gated [permissions](/concepts/permissions) (`token`, `tenant_id`, `endpoint`, `args`, `status`) |
491+
| `corsair_connect_requests` | A tenant's pending connect prompt, written when a call needs auth and read by the client to open the connect dialog (`tenant_id`, `plugin`, `connect_url`) |
461492

462493
```sql
463494
-- corsair_entities example (a Slack message)
@@ -569,7 +600,7 @@ export const corsair = createCorsair({
569600
</Tab>
570601
<Tab title="Drizzle / Prisma">
571602

572-
Define the five Corsair tables in your ORM schema (see migration tabs above), run your normal migrations, and pass the **underlying connection** to Corsair, not the ORM client:
603+
Define the six Corsair tables in your ORM schema (see migration tabs above), run your normal migrations, and pass the **underlying connection** to Corsair, not the ORM client:
573604

574605
```ts
575606
const pool = new Pool({ connectionString: process.env.DATABASE_URL });

docs/quick-start.mdx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Keep your KEK safe. Lose it and you lose access to every stored credential. Trea
6060

6161
## Create the database
6262

63-
Corsair stores data in five tables. SQLite is the fastest way to start:
63+
Corsair stores data in six tables. SQLite is the fastest way to start:
6464

6565
<CodeGroup>
6666
```bash npm
@@ -136,6 +136,13 @@ CREATE TABLE IF NOT EXISTS corsair_permissions (
136136
expires_at TEXT NOT NULL,
137137
error TEXT
138138
);
139+
140+
CREATE TABLE IF NOT EXISTS corsair_connect_requests (
141+
tenant_id TEXT PRIMARY KEY,
142+
plugin TEXT NOT NULL,
143+
connect_url TEXT NOT NULL,
144+
requested_at TEXT NOT NULL
145+
);
139146
```
140147

141148
</Accordion>
@@ -254,7 +261,7 @@ Load your app so the mounted route gets its first hit. That request registers yo
254261
Building a product? Flip one flag and every user gets their own data and credentials.
255262
</Card>
256263
<Card title="Database options" href="/concepts/database">
257-
Postgres, Drizzle, Prisma, and the five tables Corsair uses.
264+
Postgres, Drizzle, Prisma, and the six tables Corsair uses.
258265
</Card>
259266
<Card title="Provisioning" href="/concepts/provisioning">
260267
Seed credentials and provision tenants from the `corsair` CLI or `setupCorsair`.

0 commit comments

Comments
 (0)