-- Deploy gaia:api_2016_08_18_create_table_api_diarycheck to mysql

BEGIN;

CREATE TABLE `api_diarycheck` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `diary_id` integer NOT NULL,
    `person_id` char(32) NOT NULL,
    `check_time` datetime(6) NOT NULL,
    `content_level` varchar(8) NOT NULL,
    `check_content` longtext,
    `title` varchar(128) NOT NULL,
    `send_message` longtext
)
;
ALTER TABLE `api_diarycheck` ADD CONSTRAINT `diary_id_refs_id_751494ff` FOREIGN KEY (`diary_id`) REFERENCES `api_diary` (`id`);
ALTER TABLE `api_diarycheck` ADD CONSTRAINT `person_id_refs_id_6d45e406` FOREIGN KEY (`person_id`) REFERENCES `api_person` (`id`);

CREATE TABLE `api_diarymessage` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `description` varchar(50) NOT NULL,
    `title` varchar(128) NOT NULL,
    `message` longtext NOT NULL,
    `is_delete` bool NOT NULL,
    `level` varchar(8) NOT NULL
)
;

COMMIT;
