-- Deploy gaia:themis_2017_02_17_create_team_teamuser to mysql

BEGIN;

CREATE TABLE `themis_team` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(128) NOT NULL UNIQUE,
    `team_type` varchar(8) NOT NULL,
    `parent_team_id` integer
)
;
ALTER TABLE `themis_team` ADD CONSTRAINT `parent_team_id_refs_id_9d11a121` FOREIGN KEY (`parent_team_id`) REFERENCES `themis_team` (`id`);
CREATE TABLE `themis_teamuser` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `team_id` integer NOT NULL,
    `user_id` integer NOT NULL
)
;
ALTER TABLE `themis_teamuser` ADD CONSTRAINT `user_id_refs_id_0f4f6c61` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);
ALTER TABLE `themis_teamuser` ADD CONSTRAINT `team_id_refs_id_c553d53b` FOREIGN KEY (`team_id`) REFERENCES `themis_team` (`id`);

COMMIT;
