-- Deploy gaia:api_2016_06_20_add_table_api_operate_team to mysql

BEGIN;

CREATE TABLE `api_operate_team` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(30) NOT NULL,
    `note` varchar(200) NOT NULL,
    `created_time` datetime(6)
)
;
CREATE TABLE `api_operate_team_operate` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `operate_id` integer NOT NULL,
    `user_id` integer NOT NULL,
    `create_time` datetime(6)
)
;
ALTER TABLE `api_operate_team_operate` ADD CONSTRAINT `operate_id_refs_id_669c5aa0` FOREIGN KEY (`operate_id`) REFERENCES `api_operate_team` (`id`);
ALTER TABLE `api_operate_team_operate` ADD CONSTRAINT `user_id_refs_id_38d303dd` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
CREATE TABLE `api_operate_team_business` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `operate_id` integer NOT NULL,
    `user_id` integer NOT NULL,
    `create_time` datetime(6)
)
;
ALTER TABLE `api_operate_team_business` ADD CONSTRAINT `operate_id_refs_id_969f8c74` FOREIGN KEY (`operate_id`) REFERENCES `api_operate_team` (`id`);
ALTER TABLE `api_operate_team_business` ADD CONSTRAINT `user_id_refs_id_f290026e` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

COMMIT;
