-- +migrate Up
CREATE TABLE `kind_box_reqs` (
                                `id`                    INT PRIMARY KEY AUTO_INCREMENT,
                                `benefactor_id`         INT NOT NULL,
                                `kind_box_type`         ENUM('on-table','cylindrical','stand-up') NOT NULL, -- default?
                                `count_requested`       INT UNSIGNED NOT NULL,
                                `count_accepted`        INT UNSIGNED,
                                `description`           TEXT,
                                `status`                ENUM('pending','accepted','assigned-sender-agent','rejected','delivered') NOT NULL DEFAULT 'pending',
                                `deliver_refer_time_id` INT NOT NULL,
                                `deliver_refer_date`    DATETIME NOT NULL,
                                `deliver_address_id`    INT NOT NULL,
                                `sender_agent_id`       INT,
                                `delivered_at`          DATETIME,

                                `created_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
                                `updated_at`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
                                `deleted_at`            TIMESTAMP,
                                FOREIGN KEY (`benefactor_id`)           REFERENCES `benefactors` (`id`),
                                FOREIGN KEY (`deliver_refer_time_id`)   REFERENCES `refer_times` (`id`),
                                FOREIGN KEY (`deliver_address_id`)      REFERENCES `addresses` (`id`),
                                FOREIGN KEY (`sender_agent_id`)         REFERENCES `admins` (`id`)
);

-- +migrate Down
DROP TABLE `kind_box_reqs`;