Typed decision/classification service with an in-process gte-small ONNX embedding engine and lexical fallback, JS/Python SDKs, adapters, and the otsone model family. Apache-2.0 (sub-packages keep their MIT licenses). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.6 KiB
SQL
68 lines
2.6 KiB
SQL
-- Better Auth schema (email/password accounts + sessions for the console).
|
|
--
|
|
-- Generated by the Better Auth CLI for its Postgres adapter — do not edit by
|
|
-- hand. `@/lib/auth/server` runs Better Auth against these tables when
|
|
-- VITE_AUTH_ENABLED=true (Postgres via DATABASE_URL, else the PGLite fallback).
|
|
-- The tables are harmless when auth is off. The columns are camelCase and MUST
|
|
-- stay double-quoted so Postgres preserves the case Better Auth queries by.
|
|
--
|
|
-- Migrations in this folder are the single source of truth for the schema.
|
|
-- `scripts/migrate.mjs` applies them to DATABASE_URL (build / container start)
|
|
-- and the PGLite fallback applies them on startup. Applied files are recorded by
|
|
-- name in `_migrations` and never run again.
|
|
--
|
|
-- App tables live in later files (0002_*.sql, …): snake_case, per-user tables
|
|
-- carry `user_id TEXT NOT NULL` (TEXT, not UUID — the auth-off dev user id is
|
|
-- the string 'dev-user'), and every query is scoped server-side (see
|
|
-- src/lib/auth/verify.server.ts).
|
|
|
|
create table if not exists "user" (
|
|
"id" text not null primary key,
|
|
"name" text not null,
|
|
"email" text not null unique,
|
|
"emailVerified" boolean not null,
|
|
"image" text,
|
|
"createdAt" timestamptz default CURRENT_TIMESTAMP not null,
|
|
"updatedAt" timestamptz default CURRENT_TIMESTAMP not null
|
|
);
|
|
|
|
create table if not exists "session" (
|
|
"id" text not null primary key,
|
|
"expiresAt" timestamptz not null,
|
|
"token" text not null unique,
|
|
"createdAt" timestamptz default CURRENT_TIMESTAMP not null,
|
|
"updatedAt" timestamptz not null,
|
|
"ipAddress" text,
|
|
"userAgent" text,
|
|
"userId" text not null references "user" ("id") on delete cascade
|
|
);
|
|
|
|
create table if not exists "account" (
|
|
"id" text not null primary key,
|
|
"accountId" text not null,
|
|
"providerId" text not null,
|
|
"userId" text not null references "user" ("id") on delete cascade,
|
|
"accessToken" text,
|
|
"refreshToken" text,
|
|
"idToken" text,
|
|
"accessTokenExpiresAt" timestamptz,
|
|
"refreshTokenExpiresAt" timestamptz,
|
|
"scope" text,
|
|
"password" text,
|
|
"createdAt" timestamptz default CURRENT_TIMESTAMP not null,
|
|
"updatedAt" timestamptz not null
|
|
);
|
|
|
|
create table if not exists "verification" (
|
|
"id" text not null primary key,
|
|
"identifier" text not null,
|
|
"value" text not null,
|
|
"expiresAt" timestamptz not null,
|
|
"createdAt" timestamptz default CURRENT_TIMESTAMP not null,
|
|
"updatedAt" timestamptz default CURRENT_TIMESTAMP not null
|
|
);
|
|
|
|
create index if not exists "session_userId_idx" on "session" ("userId");
|
|
create index if not exists "account_userId_idx" on "account" ("userId");
|
|
create index if not exists "verification_identifier_idx" on "verification" ("identifier");
|