CREATE TABLE `ads` (
  `id` int(11) NOT NULL,
  `name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `type` varchar(25) COLLATE utf8_bin DEFAULT NULL,
  `ads_code` text COLLATE utf8_bin,
  `ads_data` text COLLATE utf8_bin,
  `display_user` int(1) DEFAULT NULL,
  `status` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

INSERT INTO `ads` (`id`, `name`, `type`, `ads_code`, `ads_data`, `display_user`, `status`) VALUES
(1, '300 x 250', 'code', '&lt;a href=&quot;https://codelug.com&quot; class=&quot;d-flex align-items-center justify-content-center w-lg-300 bg-grad ratio ratio-1x1 rounded-3 mx-auto text-white text-uppercase fs-xs ls-widest fw-bold text-center&quot;&gt;Advertising space&lt;/a&gt;', 'null', 2, 1),
(2, '728 x 90', 'code', '&lt;a href=&quot;https://codelug.com&quot; class=&quot;d-block w-lg-728 w-100 bg-grad py-4 rounded-3 mx-auto text-white text-uppercase fs-xs ls-widest fw-bold text-center&quot;&gt;Advertising space&lt;/a&gt;', 'null', 2, 1);

CREATE TABLE `categories` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `self` varchar(255) DEFAULT NULL,
  `description` text,
  `color` varchar(255) DEFAULT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `footer` tinyint(1) DEFAULT NULL,
  `featured` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `collections` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `self` varchar(255) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `color` varchar(25) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `privacy` int(11) DEFAULT NULL,
  `featured` int(11) DEFAULT NULL,
  `created` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `collections_post` (
  `id` int(11) NOT NULL,
  `collection_id` int(11) DEFAULT NULL,
  `post_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `comments` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `post_id` int(11) DEFAULT NULL,
  `parent_id` int(11) DEFAULT NULL,
  `rating` tinyint(1) DEFAULT NULL,
  `type` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `comment` varchar(255) CHARACTER SET utf8mb4 DEFAULT NULL,
  `spoiler` int(1) DEFAULT NULL,
  `status` int(1) DEFAULT NULL,
  `created` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE `comments_reaction` (
  `id` int(11) NOT NULL,
  `comment_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `reaction` varchar(11) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `languages` (
  `id` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `language` varchar(20) DEFAULT NULL,
  `status` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `languages` (`id`, `name`, `language`, `status`) VALUES
(1, 'English', 'en', 1);

CREATE TABLE `pages` (
  `id` int(11) NOT NULL,
  `name` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
  `self` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `description` varchar(600) COLLATE utf8_bin DEFAULT NULL,
  `body` text COLLATE utf8_bin,
  `status` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  `footer` int(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `posts` (
  `id` bigint(20) NOT NULL,
  `type` varchar(20) DEFAULT NULL,
  `title` varchar(255) DEFAULT NULL,
  `self` varchar(255) DEFAULT NULL,
  `image` varchar(64) DEFAULT NULL,
  `description` text,
  `control` text,
  `source` varchar(255) DEFAULT NULL,
  `keywords` text,
  `meta_title` varchar(255) DEFAULT NULL,
  `meta_description` varchar(255) DEFAULT NULL,
  `resolution` varchar(24) DEFAULT NULL,
  `api_id` varchar(64) DEFAULT NULL,
  `api_type` varchar(255) DEFAULT NULL,
  `view` bigint(25) DEFAULT '0',
  `featured` tinyint(1) DEFAULT '2',
  `status` tinyint(1) DEFAULT NULL,
  `comment` tinyint(1) DEFAULT NULL,
  `member` tinyint(1) DEFAULT NULL,
  `created` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `posts_category` (
  `post_id` int(11) NOT NULL,
  `category_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `posts_like` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `post_id` int(11) DEFAULT NULL,
  `reaction` varchar(20) COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `posts_log` (
  `id` int(11) NOT NULL,
  `user_id` int(11) DEFAULT NULL,
  `post_id` int(11) NOT NULL,
  `created` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `reports` (
  `id` int(11) NOT NULL,
  `report` int(1) DEFAULT NULL,
  `body` varchar(300) COLLATE utf8_bin DEFAULT NULL,
  `type` varchar(10) COLLATE utf8_bin DEFAULT NULL,
  `report_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `status` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `name` varchar(25) DEFAULT NULL,
  `data` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `settings` (`id`, `name`, `data`) VALUES
(1, 'general', '{\"company\":\"Gamepug\",\"language\":\"en\",\"dashboard_language\":\"en\",\"history\":\"1\",\"custom_code\":\"\",\"footer_text\":\"\",\"logo\":\"logo.svg\",\"dark_logo\":\"dark_logo.svg\",\"favicon\":\"favicon.svg\"}'),
(2, 'customize', '{\"color\":\"#ff4c44\",\"xp_color\":\"#ff4c44\",\"newest\":\"34\",\"popular\":\"14\",\"random\":\"10\",\"listing\":\"76\",\"collection\":\"76\",\"play_xp\":\"\",\"comment_xp\":\"\"}'),
(3, 'seo', '{\"title\":\"Online Games on Gamepug — Let\'s play\",\"description\":\"Online Games on Gamepug — Let\'s play\",\"games_title\":\"HTML5 Online Arcade on Gamepug\",\"games_description\":\"HTML5 Online Arcade on Gamepug\",\"play_title\":\"[name] Free play Online Games on Gamepug\",\"play_description\":\"[name] Free play Online Games on Gamepug\",\"profile_title\":\"#[username] player — Gamepug\",\"profile_description\":\"Online Games on Gamepug — Let\'s play\",\"category_title\":\"[name] Online Games on Gamepug\",\"category_description\":\"[name] Free play game you can play in the browser or from\",\"tag_title\":\"[name] games with tags — Gamepug\",\"tag_description\":\"[name] Free play game you can play in the browser or from\",\"search_title\":\"Search result [name] — Gamepug\",\"search_description\":\"[name] Free play game you can play in the browser or from\"}'),
(4, 'email', '{\"host\":\"\",\"username\":\"\",\"password\":\"\",\"port\":\"\",\"security\":\"ssl\",\"sendemail\":\"\"}'),
(5, 'api', '{\"gamepix\":\"\"}');

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `account_type` varchar(30) DEFAULT NULL,
  `name` varchar(64) DEFAULT NULL,
  `username` varchar(64) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `password` varchar(64) DEFAULT NULL,
  `avatar` varchar(64) DEFAULT NULL,
  `token` varchar(255) DEFAULT NULL,
  `gender` varchar(15) DEFAULT NULL,
  `about` varchar(255) DEFAULT NULL,
  `color` varchar(8) DEFAULT NULL,
  `status` tinyint(2) DEFAULT NULL,
  `xp` int(10) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `updated` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO `users` (`id`, `account_type`, `name`, `username`, `email`, `password`, `avatar`, `token`, `gender`, `about`, `color`, `status`, `xp`, `created`, `updated`) VALUES
(1, 'admin', 'Gamepug', 'admin', 'admin@admin.com', '938c8a307c7cd31299e70a0e4c1ad372', NULL, 'e83252fefb90b739cc434e6ef5b83ced', NULL, NULL, '#66D78C', 1, NULL, '2022-04-17 18:25:09', NULL);


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

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

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

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

ALTER TABLE `comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user` (`user_id`);

ALTER TABLE `comments_reaction`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reaction` (`comment_id`);

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

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

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

ALTER TABLE `posts_category`
  ADD PRIMARY KEY (`post_id`,`category_id`) USING BTREE;

ALTER TABLE `posts_like`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_reaction` (`user_id`);

ALTER TABLE `posts_log`
  ADD PRIMARY KEY (`id`) USING BTREE;

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

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

ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD KEY `users_idx_id` (`id`,`name`,`username`,`avatar`) USING BTREE;


ALTER TABLE `ads`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

ALTER TABLE `categories`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `collections`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `collections_post`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `comments_reaction`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `languages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

ALTER TABLE `pages`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `posts`
  MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;

ALTER TABLE `posts_like`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `posts_log`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `reports`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

ALTER TABLE `settings`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;