DROP TABLE tokens;
CREATE TABLE tokens (
    token text PRIMARY KEY NOT NULL UNIQUE,
    username text NOT NULL REFERENCES users(name),
    description text NOT NULL DEFAULT '-',
    user_agent text NOT NULL DEFAULT '-',
    ip inet NOT NULL,
    last_used timestamp with time zone NOT NULL DEFAULT current_timestamp,
    LIKE base INCLUDING DEFAULTS
);

CREATE INDEX ON tokens (username);
CREATE TRIGGER update_tokens_updated_at BEFORE UPDATE ON tokens FOR EACH ROW EXECUTE PROCEDURE  update_updated_at_column();
