-- Deploy gaia:api_2018_10_31_add_soyoungserviceitem_table to mysql

BEGIN;

CREATE TABLE `api_soyoungserviceitem` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `soyoung_serviceitem_id` integer NOT NULL UNIQUE,
    `sku_name` varchar(128) NOT NULL,
    `doctor_name` varchar(128) NOT NULL,
    `hospital_name` varchar(128) NOT NULL,
    `sku_price` integer NOT NULL,
    `reservation_nums` varchar(128) NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `update_time` datetime(6) NOT NULL,
    `is_online` bool NOT NULL
)
;
CREATE TABLE `api_soyoungskugengmeiskurelation` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `serviceitem_id` integer NOT NULL UNIQUE,
    `soyoung_serviceitem_id` integer NOT NULL UNIQUE,
    UNIQUE (`serviceitem_id`, `soyoung_serviceitem_id`)
)
;
ALTER TABLE `api_soyoungskugengmeiskurelation` ADD CONSTRAINT `serviceitem_id_refs_id_190313bb` FOREIGN KEY (`serviceitem_id`) REFERENCES `api_serviceitem` (`id`);
ALTER TABLE `api_soyoungskugengmeiskurelation` ADD CONSTRAINT `soyoung_serviceitem_id_refs_soyoung_serviceitem_id_8944f990` FOREIGN KEY (`soyoung_serviceitem_id`) REFERENCES `api_soyoungserviceitem` (`soyoung_serviceitem_id`);
COMMIT;
