-- Deploy gaia:api_20180402_wordrel to mysql

BEGIN;

CREATE TABLE `api_wordrel` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `keyword` varchar(50) NOT NULL,
    `category` varchar(5) NOT NULL,
    `created_time` datetime(6) NOT NULL,
    `updated_time` datetime(6) NOT NULL
)
;
CREATE TABLE `api_wordrelsynonym` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `wordrel_id` integer NOT NULL,
    `word` varchar(50) NOT NULL UNIQUE
)
;
ALTER TABLE `api_wordrelsynonym` ADD CONSTRAINT `wordrel_id_refs_id_2d1abef7` FOREIGN KEY (`wordrel_id`) REFERENCES `api_wordrel` (`id`);
CREATE TABLE `api_wordrelresemble` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `wordrel_id` integer NOT NULL,
    `word` varchar(50) NOT NULL
)
;
ALTER TABLE `api_wordrelresemble` ADD CONSTRAINT `wordrel_id_refs_id_2d90352e` FOREIGN KEY (`wordrel_id`) REFERENCES `api_wordrel` (`id`);

CREATE INDEX `api_wordrelsynonym_a24ba7e7` ON `api_wordrelsynonym` (`wordrel_id`);
CREATE INDEX `api_wordrelresemble_a24ba7e7` ON `api_wordrelresemble` (`wordrel_id`);
CREATE INDEX `api_wordrelresemble_558fda87` ON `api_wordrelresemble` (`word`);

COMMIT;
