-- Deploy gaia:create_table_topic_video to mysql

BEGIN;

-- XXX Add DDLs here.
CREATE TABLE `api_topic_video` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `topic_id` integer UNIQUE,
    `video_url` varchar(128) NOT NULL,
    `video_pic` varchar(128) NOT NULL,
    `persistentId` varchar(128) NOT NULL,
    `persistent_status` integer NOT NULL,
    `water_url` varchar(128) NOT NULL
)
;
ALTER TABLE `api_topic_video` ADD CONSTRAINT `topic_id_refs_id_646d4ca8` FOREIGN KEY (`topic_id`) REFERENCES `api_problem` (`id`);
CREATE INDEX `api_topic_video_2014e333` ON `api_topic_video` (`persistent_status`);

CREATE TABLE `api_video_white_list` (
    `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
    `user_id` integer NOT NULL UNIQUE
)
;
ALTER TABLE `api_video_white_list` ADD CONSTRAINT `user_id_refs_id_c5839f6f` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`);

COMMIT;
