Expand description
Shared database schema and query definitions. Used by: Axum server, Cloudflare Worker, TUI local DB.
Constants§
- INVITATIONS_
SCHEMA - Schema for team invitations (provider-agnostic).
- INVITATION_
COLUMNS - Column list for invitation SELECT queries.
- INVITATION_
DUP_ CHECK_ EMAIL - Check for duplicate pending invitation by email.
- INVITATION_
DUP_ CHECK_ OAUTH - Check for duplicate pending invitation by OAuth provider.
- INVITATION_
INSERT - INSERT a new invitation (8 params).
- INVITATION_
LOOKUP - Lookup an invitation by id.
- INVITATION_
UPDATE_ STATUS - Update an invitation’s status.
- LOCAL_
SCHEMA - Local-only SQLite schema for TUI + Daemon (not on the server).
- MEMBER_
COLUMNS - Column list for member SELECT queries (joins with users table).
- MEMBER_
DELETE - DELETE a team member.
- MEMBER_
INSERT - INSERT a team member.
- MEMBER_
JOINED_ AT - Get a team member’s joined_at timestamp.
- OAUTH_
IDENTITIES_ SCHEMA - Schema for the generic OAuth identities table (used by migration).
- OAUTH_
IDENTITY_ FIND_ BY_ PROVIDER - Find a user by OAuth identity.
- OAUTH_
IDENTITY_ FIND_ BY_ USER - Find all OAuth identities for a user.
- OAUTH_
IDENTITY_ MATCH - Check if a user has a matching OAuth identity.
- OAUTH_
IDENTITY_ UPSERT - UPSERT an OAuth identity (link or update).
- OAUTH_
STATES_ SCHEMA - Schema for OAuth state tokens (CSRF protection).
- OAUTH_
STATE_ DELETE - Delete a used OAuth state token.
- OAUTH_
STATE_ INSERT - Insert an OAuth state token.
- OAUTH_
STATE_ VALIDATE - Validate and retrieve an OAuth state token.
- REFRESH_
TOKENS_ SCHEMA - Schema for refresh tokens.
- REFRESH_
TOKEN_ DELETE - Delete refresh token by hash.
- REFRESH_
TOKEN_ INSERT - Insert refresh token.
- REFRESH_
TOKEN_ LOOKUP - Lookup refresh token with user join.
- SCHEMA
- SQLite schema (compatible with D1). Does NOT include FTS5 (Axum-only).
- SESSION_
COLUMNS - Column list for session SELECT queries (joins with users table).
- SESSION_
INSERT - INSERT a new session (17 params).
- SESSION_
LINKS_ BY_ SESSION - SELECT all links for a session (both directions).
- SESSION_
LINKS_ SCHEMA - Session links schema (shared: server, worker, local).
- SESSION_
LINK_ INSERT - INSERT a session link.
- TEAM_
COLUMNS - Column list for team SELECT queries.
- TEAM_
CREATED_ AT - Get a team’s created_at timestamp.
- TEAM_
EXISTS - Check if a team exists.
- TEAM_
INSERT - INSERT a new team (5 params: id, name, description, is_public, created_by).
- TEAM_
MEMBER_ COUNT - Count members in a team.
- TEAM_
MEMBER_ EXISTS - Check if a user is a member of a team.
- TEAM_
MEMBER_ ROLE - Get a team member’s role.
- TEAM_
NAME_ BY_ ID - Get a team’s name by id.
- TEAM_
UPDATE_ DESCRIPTION - Update a team’s description.
- TEAM_
UPDATE_ NAME - Update a team’s name.
- TEAM_
UPDATE_ VISIBILITY - Update a team’s visibility.
- USER_
BY_ API_ KEY - Find user by API key (for Bearer osk_xxx auth).
- USER_
BY_ EMAIL_ FOR_ LOGIN - Find user by email (for login).
- USER_
BY_ ID - Find user by id (for JWT auth).
- USER_
BY_ NICKNAME - Find a user by nickname (returns id).
- USER_
COUNT - Count users (for first-user-is-admin check).
- USER_
EMAIL_ AVATAR - Get user email and avatar (for settings).
- USER_
EMAIL_ EXISTS - Check email existence.
- USER_
INSERT - Insert user (legacy, no email).
- USER_
INSERT_ WITH_ EMAIL - Insert user with email/password.
- USER_
PASSWORD_ FIELDS - Get password hash/salt for a user.
- USER_
SETTINGS_ FIELDS - Get user API key and created_at (for settings).
- USER_
UPDATE_ API_ KEY - Regenerate API key.
- USER_
UPDATE_ PASSWORD - Update password.
Statics§
- INVITATION_
LIST_ MY - List pending, non-expired invitations for a user by email or OAuth identity. Params: ?1 = email, ?2 = user_id (for OAuth identity lookup).
- MEMBER_
LIST - List members of a team (joins with users table).
- SESSION_
GET - SELECT a single session by id.
- SESSION_
LIST_ BASE - Base SELECT for session listings. Append WHERE / ORDER BY / LIMIT at call site.
- TEAM_
GET - SELECT a single team by id.
- TEAM_
LIST_ MY - List teams for a user (via team_members join).