CREATE TABLE IF NOT EXISTS purchases(
    id UUID PRIMARY KEY,

    user_id UUID NOT NULL REFERENCES users(id),
    stripe_id TEXT NOT NULL,
    status TEXT NOT NULL,
    token_packs INT NOT NULL,
    cost_per_token INT NOT NULL,
    tokens_purchased INT NOT NULL,
    cost INT NOT NULL,
    created_at TIMESTAMPTZ NOT NULL
);

CREATE INDEX idx_token_purchases_user_id ON purchases(user_id);
