-- =====================================================================
-- CONTENT SCHEMA — Part 23: per-project assets (footage / images / audio / fonts)
-- Named asset files attached to a renderable project, alongside its .aep.
-- =====================================================================

SET search_path TO content, public;

CREATE TABLE IF NOT EXISTS project_assets (
    id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    project_id  UUID        NOT NULL,
    name        TEXT        NOT NULL,
    kind        TEXT        NOT NULL DEFAULT 'footage',  -- footage | image | audio | font | other
    url         TEXT        NOT NULL,
    minio_key   TEXT,
    size_bytes  BIGINT,
    sort        INT         NOT NULL DEFAULT 0,
    created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_project_assets_project ON project_assets (project_id, sort);
