UPDATE `tbl_users` SET `password` = MD5(`password`);

ALTER TABLE `tbl_movies` ADD `subtitle` VARCHAR(20) NOT NULL DEFAULT 'false' AFTER `is_slider`;

CREATE TABLE `tbl_subtitles` (
  `id` int(10) NOT NULL,
  `post_id` int(10) NOT NULL,
  `language` varchar(60) COLLATE utf8_unicode_ci NOT NULL,
  `subtitle_type` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `subtitle_url` text COLLATE utf8_unicode_ci NOT NULL,
  `type` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `tbl_subtitles`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `tbl_subtitles`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;

ALTER TABLE `tbl_settings` 
	ADD `banner_ad_type` VARCHAR(30) NOT NULL DEFAULT 'admob' AFTER `banner_ad_id_ios`, 
	ADD `banner_facebook_id` TEXT NOT NULL AFTER `banner_ad_type`, 
	ADD `interstital_ad_type` VARCHAR(30) NOT NULL DEFAULT 'admob' AFTER `banner_facebook_id`, 
	ADD `interstital_facebook_id` TEXT NOT NULL AFTER `interstital_ad_type`;

ALTER TABLE `tbl_users` ADD `register_on` VARCHAR(200) NOT NULL DEFAULT '0' AFTER `status`;

ALTER TABLE `tbl_users` CHANGE `status` `status` INT(2) NOT NULL DEFAULT '1';

ALTER TABLE `tbl_users` CHANGE `user_type` `user_type` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

CREATE TABLE `tbl_smtp_settings` (
  `id` int(5) NOT NULL,
  `smtp_type` varchar(20) NOT NULL,
  `smtp_host` varchar(150) NOT NULL,
  `smtp_email` varchar(150) NOT NULL,
  `smtp_password` text NOT NULL,
  `smtp_secure` varchar(20) NOT NULL,
  `port_no` varchar(10) NOT NULL,
  `smtp_ghost` varchar(150) NOT NULL,
  `smtp_gemail` varchar(150) NOT NULL,
  `smtp_gpassword` text NOT NULL,
  `smtp_gsecure` varchar(20) NOT NULL,
  `gport_no` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `tbl_smtp_settings` (`id`, `smtp_type`, `smtp_host`, `smtp_email`, `smtp_password`, `smtp_secure`, `port_no`, `smtp_ghost`, `smtp_gemail`, `smtp_gpassword`, `smtp_gsecure`, `gport_no`) VALUES
(1, 'server', '', '', '', 'ssl', '465', 'smtp.gmail.com', '', '', 'ssl', '465');

ALTER TABLE `tbl_smtp_settings` 
  ADD PRIMARY KEY (`id`);

ALTER TABLE `tbl_smtp_settings`
  MODIFY `id` int(5) NOT NULL AUTO_INCREMENT;

ALTER TABLE `tbl_settings` ADD `user_agent` VARCHAR(150) NOT NULL AFTER `interstital_facebook_id`;

ALTER TABLE `tbl_episode` ADD `subtitle` VARCHAR(20) NOT NULL DEFAULT 'false' AFTER `total_views`;

ALTER TABLE `tbl_channels` CHANGE `user_agent` `user_agent` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'false';

ALTER TABLE `tbl_channels` CHANGE `user_agent_type` `user_agent_type` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

ALTER TABLE `tbl_channels` ADD `user_agent_name` VARCHAR(100) NULL DEFAULT NULL AFTER `user_agent_type`;

ALTER TABLE `tbl_settings` ADD `omdb_api_key` VARCHAR(150) NOT NULL AFTER `user_agent`;

CREATE TABLE `tbl_quality` (
  `id` int(10) NOT NULL,
  `post_id` int(10) NOT NULL,
  `post_upload_type` VARCHAR(30) NOT NULL,
  `quality_480` text COLLATE utf8_unicode_ci NOT NULL,
  `quality_720` text COLLATE utf8_unicode_ci NOT NULL,
  `quality_1080` text COLLATE utf8_unicode_ci NOT NULL,
  `type` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
  `status` int(1) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

ALTER TABLE `tbl_quality`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `tbl_quality`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT;

ALTER TABLE `tbl_movies` ADD `is_quality` VARCHAR(20) NOT NULL DEFAULT 'false' AFTER `subtitle`;

ALTER TABLE `tbl_episode` ADD `is_quality` VARCHAR(20) NOT NULL DEFAULT 'false' AFTER `subtitle`;

ALTER TABLE `tbl_rating` CHANGE `dt_rate` `dt_rate` VARCHAR(255) NOT NULL;

CREATE TABLE `tbl_active_log` (
  `id` int(10) NOT NULL,
  `user_id` int(10) NOT NULL,
  `date_time` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `tbl_active_log`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `tbl_active_log`
  MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;

ALTER TABLE `tbl_settings` 
  ADD `envato_ios_purchase_code` VARCHAR(255) NOT NULL AFTER `envato_purchased_status`, 
  ADD `envato_ios_purchased_status` INT(2) NOT NULL DEFAULT '0' AFTER `envato_ios_purchase_code`;