Files
audioblume/crates/audioblume-data/migrations/0001_init.sql
rob thijssen 4f49a1d74b feat: scaffold audioblume audiobook backend foundation
Cargo workspace with the entities/core/data/api/cli crate split:

- entities: content-addressing (Sha256), ISBN-13, ids, domain types, DTOs
- core: dedup upload orchestration, access-decision gating, Argon2id auth,
  catalog browse, and the data-access port traits
- data: sqlx (Postgres, compile-time-checked, offline cache), aws-sdk-s3
  (MinIO), epub parsing; implements the core ports
- api: Axum /v1 (auth, upload, catalog, gated download, cover)
- cli: operator commands (migrate, user, copyright, work, blob, session)

Three-layer catalog (blob -> edition -> work) with content-addressed
deduplication, copyright gating (public-domain open; in-copyright/unknown
gated by ownership), and bookstore-style metadata visibility. Forward-compatible
schema for later translation, narration, voice marketplace, and sales phases.

Includes deployment assets (systemd, firewalld, nginx, sysusers, config
template), Postgres + MinIO bootstrap, and an idempotent deploy.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:13:08 +03:00

29 lines
670 B
SQL

-- Extensions and shared enum types.
--
-- gen_random_uuid() is built into PostgreSQL core (>= 13), so no pgcrypto is required.
-- pg_trgm powers fuzzy work clustering. Email case-insensitivity is handled with a
-- lower(email) unique index rather than citext, which keeps sqlx's compile-time type
-- checking happy.
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE TYPE copyright_status AS ENUM (
'unknown',
'public_domain',
'in_copyright',
'licensed_for_sale'
);
CREATE TYPE entitlement_source AS ENUM (
'upload',
'purchase',
'grant'
);
CREATE TYPE blob_kind AS ENUM (
'epub',
'cover',
'audio_m4b',
'audio_hls_segment'
);