CREATE TABLE IF NOT EXISTS device_tokens (
    id         bigserial PRIMARY KEY,
    user_id    bigint NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    token      text NOT NULL,
    created_at timestamptz NOT NULL DEFAULT now(),
    CONSTRAINT device_tokens_token_key UNIQUE (token)
);

CREATE INDEX idx_device_tokens_user_id ON device_tokens (user_id);
