-- Deploy gaia:api_2018_09_18_add_skuexaminelist_and_skuexamine_list to mysql

BEGIN;

CREATE TABLE `api_skuexaminelist` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `title` varchar(128) NOT NULL,
    `start_time` datetime(6) NOT NULL,
    `end_time` datetime(6) NOT NULL,
    `created_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_skuexamine` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `skuexaminelist_id` integer NOT NULL,
    `serviceitem_id` integer NOT NULL,
    `created_time` datetime(6) NOT NULL,
    UNIQUE (`skuexaminelist_id`, `serviceitem_id`)
)
;
ALTER TABLE `api_skuexamine` ADD CONSTRAINT `skuexaminelist_id_refs_id_b702b5ab` FOREIGN KEY (`skuexaminelist_id`) REFERENCES `api_skuexaminelist` (`id`);
ALTER TABLE `api_skuexamine` ADD CONSTRAINT `serviceitem_id_refs_id_ff9c8188` FOREIGN KEY (`serviceitem_id`) REFERENCES `api_serviceitem` (`id`);

CREATE INDEX `api_skuexamine_cb4e1820` ON `api_skuexamine` (`skuexaminelist_id`);
CREATE INDEX `api_skuexamine_3653d311` ON `api_skuexamine` (`serviceitem_id`);

Alter TABLE `api_serviceregister` ADD  COLUMN `operator_review_type` varchar(4) NOT NULL DEFAULT 0;

COMMIT;
