CREATE TABLE media (
    id UUID PRIMARY KEY,
    owner_id UUID NOT NULL REFERENCES users(id),
    storage_path TEXT NOT NULL,
    original_filename TEXT NOT NULL,
    mime_type TEXT NOT NULL,
    hash TEXT NOT NULL UNIQUE, -- For duplicate checking
    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),

-- Optional fields from the model
extracted_location TEXT, width INTEGER, height INTEGER );

-- Indexes for faster lookups
CREATE INDEX idx_media_owner_id ON media (owner_id);

CREATE INDEX idx_media_hash ON media (hash);