-- Deploy gaia:api_2017_04_21_create_ranklist to mysql

BEGIN;

CREATE TABLE `api_ranklist` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `name` varchar(128) NOT NULL,
    `rank_type` varchar(8) NOT NULL,
    `image` varchar(300),
    `is_online` bool NOT NULL,
    `rank` integer NOT NULL,
    `special_id` integer NOT NULL
)
;
ALTER TABLE `api_ranklist` ADD CONSTRAINT `special_id_refs_id_6c613d2a` FOREIGN KEY (`special_id`) REFERENCES `api_special` (`id`);
CREATE TABLE `api_ranklistservice` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `rank_list_id` integer NOT NULL,
    `service_id` integer NOT NULL,
    `message` varchar(128) NOT NULL,
    `rank` integer NOT NULL
)
;
ALTER TABLE `api_ranklistservice` ADD CONSTRAINT `rank_list_id_refs_id_edb50838` FOREIGN KEY (`rank_list_id`) REFERENCES `api_ranklist` (`id`);
ALTER TABLE `api_ranklistservice` ADD CONSTRAINT `service_id_refs_id_90c59ce3` FOREIGN KEY (`service_id`) REFERENCES `api_service` (`id`);

COMMIT;
