From 7f1ea48e4497d2f40f159242e5fd9c2c9272650b Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Mon, 22 Jul 2024 00:32:03 +0300 Subject: [PATCH] Create base.sql Resolves #2 --- sqlcore/base.sql | 298 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 298 insertions(+) create mode 100644 sqlcore/base.sql diff --git a/sqlcore/base.sql b/sqlcore/base.sql new file mode 100644 index 0000000..fa29881 --- /dev/null +++ b/sqlcore/base.sql @@ -0,0 +1,298 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Хост: localhost +-- Время создания: Июл 21 2024 г., 21:30 +-- Версия сервера: 8.0.36-2ubuntu3 +-- Версия PHP: 7.4.33 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- База данных: `ngallery` +-- + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `followers` +-- + +CREATE TABLE `followers` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `follower_id` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `followers_notifications` +-- + +CREATE TABLE `followers_notifications` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `follower_id` int NOT NULL, + `photo_id` int NOT NULL, + `checked` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `login_tokens` +-- + +CREATE TABLE `login_tokens` ( + `id` int NOT NULL, + `token` text NOT NULL, + `user_id` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `news` +-- + +CREATE TABLE `news` ( + `id` int NOT NULL, + `body` text NOT NULL, + `time` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `photos` +-- + +CREATE TABLE `photos` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `postbody` text NOT NULL, + `photourl` text NOT NULL, + `posted_at` int NOT NULL, + `timeupload` int NOT NULL, + `exif` text NOT NULL, + `priority` int NOT NULL, + `moderated` int NOT NULL DEFAULT '1', + `place` text NOT NULL, + `endmoderation` int NOT NULL DEFAULT '0', + `content` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `photos_comments` +-- + +CREATE TABLE `photos_comments` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `photo_id` int NOT NULL, + `body` text NOT NULL, + `posted_at` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `photos_comments_rates` +-- + +CREATE TABLE `photos_comments_rates` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `comment_id` int NOT NULL, + `type` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `photos_rates` +-- + +CREATE TABLE `photos_rates` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `photo_id` int NOT NULL, + `type` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `photos_views` +-- + +CREATE TABLE `photos_views` ( + `id` int NOT NULL, + `user_id` int NOT NULL, + `photo_id` int NOT NULL, + `time` int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; + +-- -------------------------------------------------------- + +-- +-- Структура таблицы `users` +-- + +CREATE TABLE `users` ( + `id` int NOT NULL, + `username` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `photourl` text NOT NULL, + `uploadindex` int NOT NULL, + `online` int NOT NULL, + `admin` int NOT NULL DEFAULT '0', + `status` int NOT NULL DEFAULT '0', + `content` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- +-- Индексы сохранённых таблиц +-- + +-- +-- Индексы таблицы `followers` +-- +ALTER TABLE `followers` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `followers_notifications` +-- +ALTER TABLE `followers_notifications` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `login_tokens` +-- +ALTER TABLE `login_tokens` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `news` +-- +ALTER TABLE `news` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `photos` +-- +ALTER TABLE `photos` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `photos_comments` +-- +ALTER TABLE `photos_comments` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `photos_comments_rates` +-- +ALTER TABLE `photos_comments_rates` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `photos_rates` +-- +ALTER TABLE `photos_rates` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `photos_views` +-- +ALTER TABLE `photos_views` + ADD PRIMARY KEY (`id`); + +-- +-- Индексы таблицы `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT для сохранённых таблиц +-- + +-- +-- AUTO_INCREMENT для таблицы `followers` +-- +ALTER TABLE `followers` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `followers_notifications` +-- +ALTER TABLE `followers_notifications` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `login_tokens` +-- +ALTER TABLE `login_tokens` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `news` +-- +ALTER TABLE `news` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `photos` +-- +ALTER TABLE `photos` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `photos_comments` +-- +ALTER TABLE `photos_comments` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `photos_comments_rates` +-- +ALTER TABLE `photos_comments_rates` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `photos_rates` +-- +ALTER TABLE `photos_rates` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `photos_views` +-- +ALTER TABLE `photos_views` + MODIFY `id` int NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT для таблицы `users` +-- +ALTER TABLE `users` + MODIFY `id` int NOT NULL AUTO_INCREMENT; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;