forked from ebhomengo/niki
24 lines
1.1 KiB
MySQL
24 lines
1.1 KiB
MySQL
|
-- +migrate Up
|
||
|
CREATE TABLE `kind_boxes`
|
||
|
(
|
||
|
`id` INT PRIMARY KEY AUTO_INCREMENT,
|
||
|
`kind_box_req_id` INT NOT NULL,
|
||
|
`benefactor_id` INT NOT NULL,
|
||
|
`type` ENUM ('on-table','cylindrical','stand-up') NOT NULL,
|
||
|
`total_amount` INT UNSIGNED NULL NULL,
|
||
|
`serial_number` varchar(255),
|
||
|
`status` varchar(255),
|
||
|
`sender_id` INT NULL,
|
||
|
`receiver_id` INT NULL,
|
||
|
`status_changed_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
|
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||
|
FOREIGN KEY (`kind_box_req_id`) REFERENCES `kind_box_reqs` (`id`),
|
||
|
FOREIGN KEY (`benefactor_id`) REFERENCES `benefactors` (`id`),
|
||
|
FOREIGN KEY (`sender_id`) REFERENCES `admins` (`id`),
|
||
|
FOREIGN KEY (`receiver_id`) REFERENCES `admins` (`id`),
|
||
|
index `index_serial_number` (`serial_number`)
|
||
|
|
||
|
);
|
||
|
|
||
|
-- +migrate Down
|
||
|
DROP TABLE `kind_boxes`;
|