CREATE TABLE IF NOT EXISTS lesson_state (
    user_id    TEXT    NOT NULL,
    topic_id   TEXT    NOT NULL,
    lesson_id  TEXT    NOT NULL,
    current_index  INTEGER NOT NULL DEFAULT 0,
    hearts         INTEGER NOT NULL DEFAULT 5,
    correct_count  INTEGER NOT NULL DEFAULT 0,
    updated_at     TEXT    NOT NULL,
    PRIMARY KEY (user_id, topic_id, lesson_id),
    FOREIGN KEY (user_id) REFERENCES users(id)
);
