-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Erstellungszeit: 20. Jul 2022 um 01:55
-- Server-Version: 10.4.24-MariaDB
-- PHP-Version: 8.1.6

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 */;

--
-- Datenbank: `proxima`
--

DELIMITER $$
--
-- Prozeduren
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `permission_backup` ()   BEGIN
INSERT INTO backup_permissions(user_id,permission_nodes,vip)
   SELECT * FROM permission;
END$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `user_backup` ()   BEGIN
  INSERT INTO backup_user(id,username,password,name,nachname,email,profile_likes,profile_pic,profile_id)
  SELECT * FROM user ;
END$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `videos_backup` ()   BEGIN
    INSERT INTO backup_videos(vid_id,file,title,likes,dislikes,premium,uploaded_on,clicks)
    SELECT * FROM videos;
END$$

DELIMITER ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `backup_permissions`
--

CREATE TABLE `backup_permissions` (
  `user_id` int(11) NOT NULL,
  `permission_nodes` varchar(100) DEFAULT NULL,
  `vip` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `backup_user`
--

CREATE TABLE `backup_user` (
  `id` int(11) NOT NULL,
  `username` varchar(20) NOT NULL,
  `password` varchar(100) NOT NULL,
  `name` varchar(30) DEFAULT NULL,
  `nachname` varchar(50) DEFAULT NULL,
  `email` varchar(254) NOT NULL,
  `profile_likes` int(11) DEFAULT NULL,
  `profile_pic` blob DEFAULT NULL,
  `watchtime` float NOT NULL,
  `points` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `backup_videos`
--

CREATE TABLE `backup_videos` (
  `vid_id` int(11) NOT NULL,
  `file` blob NOT NULL,
  `title` varchar(100) NOT NULL,
  `likes` int(11) DEFAULT 0,
  `dislikes` int(11) DEFAULT 0,
  `premium` tinyint(1) DEFAULT 0,
  `uploaded_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'always Current Timestamp',
  `clicks` int(11) DEFAULT 0 COMMENT 'accumulating per view'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `comments`
--

CREATE TABLE `comments` (
  `com_id` int(11) NOT NULL,
  `video` varchar(255) NOT NULL DEFAULT '0',
  `profile_id` int(11) NOT NULL DEFAULT 0,
  `vid_id` int(11) NOT NULL,
  `author` int(11) NOT NULL,
  `comment` varchar(255) NOT NULL,
  `commented_on` varchar(255) NOT NULL DEFAULT '1.658.099.812.084'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `has_permission`
--

CREATE TABLE `has_permission` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `interaction`
--

CREATE TABLE `interaction` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `vid_id` int(11) NOT NULL,
  `u_like` tinyint(1) NOT NULL,
  `u_dislike` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `permissions`
--

CREATE TABLE `permissions` (
  `id` int(11) NOT NULL,
  `permission_nodes` varchar(100) DEFAULT NULL,
  `vip` tinyint(1) DEFAULT 0,
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `tickets`
--

CREATE TABLE `tickets` (
  `ticket_id` int(11) NOT NULL,
  `status` varchar(50) NOT NULL,
  `author` varchar(20) NOT NULL,
  `header` varchar(50) NOT NULL,
  `body` text NOT NULL,
  `assigned_to` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `user`
--

CREATE TABLE `user` (
  `id` int(11) NOT NULL,
  `profile_likes` int(11) NOT NULL DEFAULT 0,
  `profile_id` int(11) NOT NULL,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `profile_public` tinyint(4) NOT NULL DEFAULT 0,
  `public_stats` tinyint(4) NOT NULL DEFAULT 0,
  `public_watchhistory` tinyint(4) NOT NULL DEFAULT 0,
  `sub_newsletter` tinyint(4) NOT NULL DEFAULT 0,
  `profile_pic` varchar(255) DEFAULT NULL,
  `profile_bio` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Daten für Tabelle `user`
--

INSERT INTO `user` (`id`, `profile_likes`, `profile_id`, `username`, `password`, `email`, `name`, `profile_public`, `public_stats`, `public_watchhistory`, `sub_newsletter`, `profile_pic`, `profile_bio`) VALUES
(1, 0, 1740, 'steev', '+BL]{2<5Z}^N+Bm7$:', 'mauricefl@outlook.de', NULL, 0, 0, 0, 0, 'https://cdn.slpnetwork.de/img/sys/users/Thesteev.png', NULL);

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `videos`
--

CREATE TABLE `videos` (
  `vid_id` int(11) NOT NULL,
  `likes` int(11) NOT NULL DEFAULT 0,
  `premium` tinyint(4) NOT NULL DEFAULT 0,
  `click` int(11) NOT NULL DEFAULT 0,
  `file` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `dislikes` varchar(255) NOT NULL DEFAULT '0',
  `uploaded_on` varchar(255) DEFAULT NULL,
  `creator` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Daten für Tabelle `videos`
--

INSERT INTO `videos` (`vid_id`, `likes`, `premium`, `click`, `file`, `title`, `dislikes`, `uploaded_on`, `creator`) VALUES
(2, 0, 0, 109, 'f8b00f1336f021968c9b7892de082685.mp4', 'video test', '0', NULL, 1);

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `watchhistory`
--

CREATE TABLE `watchhistory` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `vid_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `watchhistory_entity`
--

CREATE TABLE `watchhistory_entity` (
  `user_id` int(11) NOT NULL,
  `vid_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Indizes der exportierten Tabellen
--

--
-- Indizes für die Tabelle `backup_permissions`
--
ALTER TABLE `backup_permissions`
  ADD PRIMARY KEY (`user_id`);

--
-- Indizes für die Tabelle `backup_user`
--
ALTER TABLE `backup_user`
  ADD PRIMARY KEY (`id`);

--
-- Indizes für die Tabelle `backup_videos`
--
ALTER TABLE `backup_videos`
  ADD PRIMARY KEY (`vid_id`);

--
-- Indizes für die Tabelle `comments`
--
ALTER TABLE `comments`
  ADD PRIMARY KEY (`com_id`);

--
-- Indizes für die Tabelle `has_permission`
--
ALTER TABLE `has_permission`
  ADD PRIMARY KEY (`id`);

--
-- Indizes für die Tabelle `interaction`
--
ALTER TABLE `interaction`
  ADD PRIMARY KEY (`id`);

--
-- Indizes für die Tabelle `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`);

--
-- Indizes für die Tabelle `tickets`
--
ALTER TABLE `tickets`
  ADD PRIMARY KEY (`ticket_id`);

--
-- Indizes für die Tabelle `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `IDX_e12875dfb3b1d92d7d7c5377e2` (`email`);

--
-- Indizes für die Tabelle `videos`
--
ALTER TABLE `videos`
  ADD PRIMARY KEY (`vid_id`);

--
-- Indizes für die Tabelle `watchhistory`
--
ALTER TABLE `watchhistory`
  ADD PRIMARY KEY (`id`);

--
-- Indizes für die Tabelle `watchhistory_entity`
--
ALTER TABLE `watchhistory_entity`
  ADD PRIMARY KEY (`user_id`);

--
-- AUTO_INCREMENT für exportierte Tabellen
--

--
-- AUTO_INCREMENT für Tabelle `backup_permissions`
--
ALTER TABLE `backup_permissions`
  MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `comments`
--
ALTER TABLE `comments`
  MODIFY `com_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `has_permission`
--
ALTER TABLE `has_permission`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `interaction`
--
ALTER TABLE `interaction`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `tickets`
--
ALTER TABLE `tickets`
  MODIFY `ticket_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT für Tabelle `user`
--
ALTER TABLE `user`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT für Tabelle `videos`
--
ALTER TABLE `videos`
  MODIFY `vid_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT für Tabelle `watchhistory`
--
ALTER TABLE `watchhistory`
  MODIFY `id` int(11) 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 */;
