-- Deploy gaia:create_table_api_gmhome_sideskidcategory to mysql

BEGIN;

CREATE TABLE `api_gmhome_sideskidcategory_tags` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `sideskidcategory_id` integer NOT NULL,
    `tag_id` integer NOT NULL,
    UNIQUE (`sideskidcategory_id`, `tag_id`)
)
;
ALTER TABLE `api_gmhome_sideskidcategory_tags` ADD CONSTRAINT `tag_id_refs_id_8b368555` FOREIGN KEY (`tag_id`) REFERENCES `api_tag` (`id`);
CREATE TABLE `api_gmhome_sideskidcategory` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(30) NOT NULL UNIQUE,
    `ordering` integer NOT NULL,
    `is_online` bool NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_gmhome_sideskidcategory_tags` ADD CONSTRAINT `sideskidcategory_id_refs_id_15a5fee7` FOREIGN KEY (`sideskidcategory_id`) REFERENCES `api_gmhome_sideskidcategory` (`id`);

CREATE INDEX `api_gmhome_sideskidcategory_tags_2de065bb` ON `api_gmhome_sideskidcategory_tags` (`sideskidcategory_id`);
CREATE INDEX `api_gmhome_sideskidcategory_tags_5659cca2` ON `api_gmhome_sideskidcategory_tags` (`tag_id`);

COMMIT;
