CREATE TABLE `video_categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `status` tinyint(1) NOT NULL DEFAULT '1',
  `created` datetime NULL,
  `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP
);

INSERT INTO `permissions` (`title`, `type`, `permissions`)
VALUES ('Video Categories', 'video_categories', '{\"listing\":\"1\",\"create\":\"1\",\"update\":\"1\",\"delete\":\"1\"}');

ALTER TABLE `video_categories`
ADD `created_by` int(11) NULL AFTER `status`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`;

ALTER TABLE `video_categories`
ADD FOREIGN KEY (`created_by`) REFERENCES `admins` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT

ALTER TABLE `video_categories`
ADD `deleted_at` datetime NULL AFTER `created_by`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`;

ALTER TABLE `creator_videos`
ADD `category_id` int(11) NULL AFTER `creator_id`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`,
ADD FOREIGN KEY (`category_id`) REFERENCES `video_categories` (`id`) ON DELETE SET NULL;

ALTER TABLE `notifications`
CHANGE `type` `type` enum('audio_uploaded','video_uploaded','meeting_created','meeting_updated','made_announcement','schedule_uploaded','poll_created','poll_submitted','subscribe_creator','renew_creator','changes_in_plan','review_received','review_updated','questions_received','video_likes','made_video_category') COLLATE 'utf8_general_ci' NULL AFTER `message`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`;

ALTER TABLE `creator_video_categories`
ADD `time` time NULL AFTER `title`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`;


ALTER TABLE `creator_about`
ADD `categories` json NULL AFTER `members_visibility`,
CHANGE `modified` `modified` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE CURRENT_TIMESTAMP AFTER `created`;
