-- =====================================================
-- Migration: user_states
-- মাল্টি-স্টেপ কনভারসেশন (যেমন withdraw flow: method -> amount -> account number)
-- ট্র্যাক করার জন্য। schema.sql এর পরে এটা রান করুন।
-- =====================================================

CREATE TABLE IF NOT EXISTS `user_states` (
    `user_id`     BIGINT UNSIGNED PRIMARY KEY,
    `state`       VARCHAR(64) NOT NULL,       -- e.g. 'awaiting_withdraw_amount'
    `data`        TEXT DEFAULT NULL,          -- JSON blob (method, partial input ইত্যাদি)
    `updated_at`  DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

    CONSTRAINT fk_state_user FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
