CREATE TABLE billing_tasks (
    session_id text PRIMARY KEY NOT NULL,
    billing_type text NOT NULL,
    user_id uuid NOT NULL,
    bill double precision DEFAULT 0 NOT NULL,
    state billing_task_state DEFAULT 'active',
    deposit integer DEFAULT 0,
    discretization integer DEFAULT 0,
    task_status text DEFAULT 'not_started',
    last_status_update integer DEFAULT 0,
    last_payment_update integer DEFAULT 0,
    last_payment_id integer,
    queue text DEFAULT 'active',
    next_queue text DEFAULT 'active',
    meta text,
    exec_context text,
    event_id BIGSERIAL,
    cashback double precision DEFAULT 0 NOT NULL,

    FOREIGN KEY(user_id) REFERENCES "user"(id)
);
