Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions shared/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { z } from 'zod'
*
* - IDs are used in file paths and in URLs.
* They must never contain traversal characters (`/` and `.`).
* Project and user IDs are currently required to be UUID v4.
* - Project names are not used in file paths, but may be used in URLs.
* Project and user IDs are randomized strings (UUIDv4 and BetterAuth's custom ID format, respectively)
* - Project and user names are not used in file paths, but may be used in URLs.
* We enforce alphanumeric ASCII names.
* Names are unique up to recasing, natively in the database (`COLLATE NOCASE`).
* Unicode names may be added in the future.
Expand Down
18 changes: 5 additions & 13 deletions src/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,11 @@ datasource db {
model User {
/// Better-auth identifier (matches BETTERAUTH_ID_RE)
id String @id
/// Better-auth does not require uniqueness but we do.
/// These names serve two distinct purposes that require uniqueness.
///
/// First, they are a user-controlled identifier that appears in a URL as to signify the project's owner
/// Better-auth does not require name uniqueness but we do:
/// names are user-controlled identifiers that appear in a URL as part of locating the project
/// (e.g. https://example.com/my-user-name/my-first-project).
///
/// Second, they are unique long-lasting filesystem identifiers used to group a user's project
/// data on the file system.
///
/// (It's possible that in the future we will want to tease these apart,
/// and allow the URL-appearing identifier to be changed more freely by users.)
///
/// Names must match `ALPHANUM_NAME_RE`.
/// Names must match ALPHANUM_NAME_RE.
/// This column is `COLLATE NOCASE` in migration.sql
/// (Prisma cannot express SQLite collation settings),
/// so uniqueness and lookups are case-insensitive
Expand Down Expand Up @@ -111,7 +103,7 @@ model Verification {
// Workbench-specific tables

model Project {
/// 128-bit UUID.
/// 128-bit UUIDv4.
id String @id
/// Project's owner.
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
Expand All @@ -135,7 +127,7 @@ model Project {
/// A publication is live exactly while its row exists:
/// every request for it resolves through this table.
model Publication {
/// UUID; the publication's durable identity, and its directory under `publications/`.
/// UUIDv4; the publication's durable identity, and its directory under `publications/`.
id String @id
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
projectId String
Expand Down
Loading