t3-code-android-nightly/.repos/alchemy-effect/examples/neon/migrations/0001_uploads.sql
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

19 lines
677 B
SQL

CREATE TABLE uploads (
id uuid PRIMARY KEY,
owner_id text NOT NULL,
object_key text NOT NULL UNIQUE,
filename text NOT NULL,
content_type text NOT NULL,
expected_bytes bigint NOT NULL CHECK (expected_bytes BETWEEN 1 AND 10485760),
actual_bytes bigint,
status text NOT NULL DEFAULT 'awaiting_upload'
CHECK (status IN ('awaiting_upload', 'ready', 'rejected')),
created_at timestamptz NOT NULL DEFAULT now(),
processed_at timestamptz
);
CREATE INDEX uploads_owner_created ON uploads (owner_id, created_at DESC);
CREATE TABLE upload_events (
invocation_id text PRIMARY KEY,
object_key text NOT NULL,
processed_at timestamptz NOT NULL DEFAULT now()
);