-- Deploy gaia:2019_11_27_add_api_searchkeyword_operationrecord to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_searchkeyword_operationrecord` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `searchkeyword_id` integer NOT NULL,
    `operate_user_id` integer NOT NULL,
    `content` varchar(128) NOT NULL,
    `operate_time` datetime(6) NOT NULL
)
;
ALTER TABLE `api_searchkeyword_operationrecord` ADD CONSTRAINT `searchkeyword_id_refs_id_15368fa6` FOREIGN KEY (`searchkeyword_id`) REFERENCES `api_searchkeyword` (`id`);
ALTER TABLE `api_searchkeyword_operationrecord` ADD CONSTRAINT `operate_user_id_refs_id_85547472` FOREIGN KEY (`operate_user_id`) REFERENCES `auth_user` (`id`);
CREATE INDEX `api_searchkeyword_operationrecord_8baad45d` ON `api_searchkeyword_operationrecord` (`searchkeyword_id`);
CREATE INDEX `api_searchkeyword_operationrecord_7551f21d` ON `api_searchkeyword_operationrecord` (`operate_user_id`);

ALTER TABLE api_searchkeyword ADD COLUMN `explicit_word` varchar(20) default null;
ALTER TABLE api_searchkeyword ADD COLUMN `start_time` datetime(6) default null;
ALTER TABLE api_searchkeyword ADD COLUMN `end_time` datetime(6) default null;


COMMIT;
