-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1
-- Généré le : lun. 17 mars 2025 à 08:13
-- Version du serveur : 10.4.32-MariaDB
-- Version de PHP : 8.2.12

START TRANSACTION;



--
-- Base de données : `realflausite_db`
--

DELIMITER $$
--
-- Procédures
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_get_discussions` (IN `user_id` INT)   BEGIN
    SELECT MAX(M.id) AS mid, M.message_creator as message_creator, MR.receiver_id as message_receiver, M.create_date as message_date, MR.is_read as is_read 
    FROM message AS M
    INNER JOIN message_recipient AS MR ON M.id = MR.message_id
    WHERE M.message_creator = user_id OR MR.receiver_id = user_id
    GROUP BY M.message_creator, MR.receiver_id
    ORDER BY mid DESC;  -- Ensure this line ends with a semicolon
END$$

DELIMITER ;

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

--
-- Structure de la table `channel`
--

CREATE TABLE `channel` (
  `id` int(11) NOT NULL,
  `sender` int(11) DEFAULT NULL,
  `receiver` int(11) DEFAULT NULL,
  `group_recipient_id` int(11) DEFAULT NULL,
  `message_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `channel`
--

INSERT INTO `channel` (`id`, `sender`, `receiver`, `group_recipient_id`, `message_id`) VALUES
(166, 6, 1, NULL, 166),
(167, 6, 1, NULL, 167),
(168, 6, 1, NULL, 168),
(169, 6, 1, NULL, 169),
(170, 6, 1, NULL, 170),
(171, 6, 1, NULL, 171),
(172, 6, 1, NULL, 172),
(173, 6, 1, NULL, 173),
(174, 6, 1, NULL, 174),
(175, 6, 1, NULL, 175),
(176, 6, 1, NULL, 176),
(177, 6, 1, NULL, 177),
(178, 6, 1, NULL, 178),
(179, 6, 1, NULL, 179),
(180, 6, 1, NULL, 180),
(181, 6, 1, NULL, 181),
(182, 6, 1, NULL, 182),
(183, 6, 1, NULL, 183),
(184, 6, 1, NULL, 184),
(189, 1, 3, NULL, 189),
(190, 1, 3, NULL, 190),
(192, 1, 3, NULL, 192),
(193, 1, 3, NULL, 193),
(200, 1, 3, NULL, 200),
(202, 4, 2, NULL, 5);

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

--
-- Structure de la table `cinema_chat`
--

CREATE TABLE `cinema_chat` (
  `id` int(11) NOT NULL,
  `schedule_id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `message` text NOT NULL,
  `timestamp` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `cinema_chat`
--

INSERT INTO `cinema_chat` (`id`, `schedule_id`, `user_id`, `message`, `timestamp`) VALUES
(1, 5, 1, 'how far na guy', '2025-01-26 15:32:36'),
(2, 5, 1, 'Hello, this is a test message', '2025-01-26 15:42:27'),
(3, 8, 1, 'Hello, this is a test message', '2025-01-26 16:10:38'),
(4, 9, 2, 'Hello, this is a test message', '2025-01-26 16:12:16'),
(5, 10, 2, 'Thanks ', '2025-01-26 16:17:50'),
(6, 10, 2, 'wait ', '2025-01-26 16:18:09'),
(7, 10, 2, 'how far ', '2025-01-26 16:20:11'),
(8, 10, 2, 'yo bro ', '2025-01-26 16:25:13'),
(9, 18, 2, 'wow ', '2025-01-26 17:08:20'),
(10, 16, 2, 'I like that ', '2025-01-26 17:08:29'),
(11, 19, 2, 'hmmm', '2025-01-26 17:08:54'),
(12, 19, 4, 'what\'s up ', '2025-01-26 17:11:40'),
(13, 19, 4, 'I really like this ', '2025-01-26 17:11:52'),
(14, 19, 4, 'yo bro', '2025-01-26 17:13:54'),
(15, 19, 4, 'how far ', '2025-01-26 17:14:02'),
(16, 19, 4, 'hello', '2025-01-26 17:14:11'),
(17, 16, 2, 'how far ', '2025-01-26 17:27:52'),
(18, 19, 4, 'So seems the video hast yet started ?', '2025-01-26 19:23:20'),
(19, 21, 4, 'hello ', '2025-01-27 07:08:23'),
(20, 21, 4, 'I wanted to find out ', '2025-01-27 07:08:31'),
(21, 24, 4, 'when I would see my ghetto life fade away ', '2025-01-27 16:27:12'),
(22, 25, 4, 'be like you want to watch the movie on your own ', '2025-01-29 08:54:28'),
(23, 25, 4, 'so stop doing that then ', '2025-01-29 08:54:40'),
(24, 25, 2, 'hey sup bro ', '2025-01-29 08:55:30'),
(25, 25, 2, 'we was late ', '2025-01-29 08:55:40'),
(26, 25, 2, 'I didn\'t expect that ', '2025-01-29 08:56:06'),
(27, 28, 4, 'yo', '2025-02-06 14:30:43');

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

--
-- Structure de la table `comment`
--

CREATE TABLE `comment` (
  `id` int(11) NOT NULL,
  `comment_owner` int(11) NOT NULL,
  `post_id` int(11) NOT NULL,
  `comment_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `comment_edit_date` timestamp NULL DEFAULT NULL,
  `comment_text` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `comment`
--

INSERT INTO `comment` (`id`, `comment_owner`, `post_id`, `comment_date`, `comment_edit_date`, `comment_text`) VALUES
(10, 4, 26, '2025-01-28 06:32:22', NULL, 'yo'),
(11, 4, 26, '2025-01-28 06:37:54', NULL, 'what l'),
(12, 4, 26, '2025-01-28 06:38:01', NULL, 'yooebd f'),
(13, 4, 26, '2025-01-28 06:38:06', NULL, 'bfjdjejdj'),
(14, 4, 26, '2025-01-28 06:38:10', NULL, 'x xbwbdbd'),
(15, 4, 24, '2025-01-28 06:48:53', NULL, 'yo'),
(16, 4, 24, '2025-01-28 06:48:58', NULL, 'chyy7'),
(17, 4, 24, '2025-01-28 06:49:08', NULL, 'yoo'),
(18, 4, 24, '2025-01-28 06:49:18', NULL, 'hmm'),
(19, 4, 2, '2025-01-28 19:41:13', NULL, 'yo'),
(20, 4, 7, '2025-02-04 08:46:45', NULL, 'That&#039;s not it'),
(21, 4, 7, '2025-02-04 08:47:00', NULL, 'I don&#039;t really like this'),
(22, 4, 7, '2025-02-04 08:47:12', NULL, 'clear all comments'),
(23, 1, 1, '2025-03-17 06:27:54', NULL, 'it&#039;s better this way');

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

--
-- Structure de la table `comments`
--

CREATE TABLE `comments` (
  `id` int(11) NOT NULL,
  `user_id` int(20) DEFAULT NULL,
  `video_id` int(11) DEFAULT NULL,
  `comment` text DEFAULT NULL,
  `comment_type` enum('public','private') DEFAULT NULL,
  `timestamp` datetime DEFAULT current_timestamp(),
  `encrypted_comment` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `comments`
--

INSERT INTO `comments` (`id`, `user_id`, `video_id`, `comment`, `comment_type`, `timestamp`, `encrypted_comment`) VALUES
(75, 4, 9, 'that\'s your point of view ', '', '2025-01-26 11:42:25', NULL),
(76, 4, 9, 'I don\'t like this ', '', '2025-01-27 07:46:30', NULL),
(77, 4, 9, 'oh my God ', '', '2025-01-27 23:33:55', NULL),
(78, 4, 9, 'this is crazy', '', '2025-02-02 11:14:34', NULL);

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

--
-- Structure de la table `contacts`
--

CREATE TABLE `contacts` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `contact_id` bigint(20) NOT NULL,
  `contact_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `contacts`
--

INSERT INTO `contacts` (`id`, `user_id`, `contact_id`, `contact_name`) VALUES
(3, 512404871496927, 1442771, 'sdfsdf'),
(4, 1442771, 512404871496927, 'dsf'),
(5, 1442771, 385792354341325, 'comfort'),
(6, 512404871496927, 385792354341325, 'E');

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

--
-- Structure de la table `dislikes`
--

CREATE TABLE `dislikes` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `dislikes`
--

INSERT INTO `dislikes` (`id`, `video_id`, `user_id`, `created_at`) VALUES
(40, 29, 385792354341325, '2024-08-08 08:48:16'),
(126, 25, 385792354341325, '2024-09-08 00:01:32'),
(135, 26, 512404871496927, '2024-09-12 21:28:33'),
(163, 38, 1442771, '2024-09-21 00:26:05');

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

--
-- Structure de la table `invitations`
--

CREATE TABLE `invitations` (
  `id` int(11) NOT NULL,
  `friend_id` int(11) NOT NULL,
  `video_url` varchar(255) NOT NULL,
  `schedule_id` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure de la table `like`
--

CREATE TABLE `like` (
  `id` int(11) NOT NULL,
  `post_id` int(11) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `like_date` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `like`
--

INSERT INTO `like` (`id`, `post_id`, `user_id`, `like_date`) VALUES
(7, 2, 4, '2025-01-28 19:10:38'),
(8, 4, 4, '2025-02-04 14:50:41'),
(9, 1, 1, '2025-03-17 06:27:45');

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

--
-- Structure de la table `likes`
--

CREATE TABLE `likes` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `likes`
--

INSERT INTO `likes` (`id`, `video_id`, `user_id`, `created_at`) VALUES
(2, 11, 4, '2025-02-03 10:21:27'),
(6, 19, 4, '2025-02-07 13:23:51');

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

--
-- Structure de la table `message`
--

CREATE TABLE `message` (
  `id` int(11) NOT NULL,
  `message_creator` int(11) DEFAULT NULL,
  `message` text DEFAULT NULL,
  `create_date` datetime NOT NULL DEFAULT current_timestamp(),
  `is_reply` int(11) DEFAULT NULL,
  `reply_to` int(11) DEFAULT NULL,
  `edited` tinyint(1) DEFAULT 0,
  `media_uri` varchar(255) DEFAULT NULL,
  `media_type` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `message`
--

INSERT INTO `message` (`id`, `message_creator`, `message`, `create_date`, `is_reply`, `reply_to`, `edited`, `media_uri`, `media_type`) VALUES
(1, 1, 'that\'s how it is ', '2025-03-17 07:25:52', 0, 0, 0, NULL, 'undefined'),
(2, 1, 'how far', '2025-03-17 07:25:59', 0, 0, 0, NULL, 'undefined'),
(3, 2, 'how far ', '2025-03-17 07:36:24', 0, 0, 0, NULL, 'undefined'),
(4, 2, 'I\'m cool bro ', '2025-03-17 07:36:36', 0, 0, 0, NULL, 'undefined'),
(5, 4, 'YO', '2025-03-17 07:43:30', NULL, NULL, 0, NULL, NULL);

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

--
-- Structure de la table `message_recipient`
--

CREATE TABLE `message_recipient` (
  `id` int(11) NOT NULL,
  `receiver_id` int(11) DEFAULT NULL,
  `message_id` int(11) DEFAULT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `sent` tinyint(1) DEFAULT 0,
  `is_delivered` tinyint(1) DEFAULT 0,
  `is_archived` tinyint(1) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `message_recipient`
--

INSERT INTO `message_recipient` (`id`, `receiver_id`, `message_id`, `is_read`, `sent`, `is_delivered`, `is_archived`) VALUES
(1, 2, 1, 1, 1, 1, 0),
(2, 2, 2, 1, 1, 1, 0),
(3, 4, 3, 0, 1, 0, 0),
(4, 1, 4, 0, 1, 0, 0),
(5, 2, 5, 0, 0, 0, 0);

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

--
-- Structure de la table `post`
--

CREATE TABLE `post` (
  `id` int(11) NOT NULL,
  `post_owner` int(11) NOT NULL,
  `post_visibility` int(11) NOT NULL DEFAULT 0,
  `post_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `post_edit_date` timestamp NULL DEFAULT NULL,
  `text_content` text DEFAULT NULL,
  `picture_media` text DEFAULT NULL,
  `video_media` text DEFAULT NULL,
  `post_place` int(11) DEFAULT 1,
  `is_shared` int(11) DEFAULT 0,
  `post_shared_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `post`
--

INSERT INTO `post` (`id`, `post_owner`, `post_visibility`, `post_date`, `post_edit_date`, `text_content`, `picture_media`, `video_media`, `post_place`, `is_shared`, `post_shared_id`) VALUES
(1, 1, 1, '2025-03-17 06:27:36', NULL, '', 'data/users/Stephania/posts/67d7c0d8d10109.73780484/media/pictures/1b2088610d8ca26eeded6a2c29b5546224a1d1f9d14551167fff1be00c0c6d4c.jpeg,c26ab5ba68bbddb6a55f414a5699b41e2b82281254e7c08b3366d7389a449f8c.jpeg,08a2826109295fb4aab263052de1437b8e9f40227594d56bf08baa97bf576a04.webp,3ac5f4b6d9d4415ca9cf4b90b7c832a36d35c1f87a5b1d3afcdff91b4827067a.jpeg,df63e6ebe2ca1f14a9b0b5a36b97545a113de8b9792ce04236166c69444c3563.jpeg', '', 1, 0, NULL);

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

--
-- Structure de la table `post_place`
--

CREATE TABLE `post_place` (
  `id` int(11) NOT NULL,
  `post_place` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `post_place`
--

INSERT INTO `post_place` (`id`, `post_place`) VALUES
(1, 'timeline'),
(2, 'group');

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

--
-- Structure de la table `post_visibility`
--

CREATE TABLE `post_visibility` (
  `id` int(11) NOT NULL,
  `visibility` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `post_visibility`
--

INSERT INTO `post_visibility` (`id`, `visibility`) VALUES
(1, 'public'),
(2, 'friends'),
(3, 'only me');

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

--
-- Structure de la table `quickies`
--

CREATE TABLE `quickies` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `views` int(11) DEFAULT 0,
  `likes` int(11) DEFAULT 0,
  `comments` int(11) DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `quickies`
--

INSERT INTO `quickies` (`id`, `video_id`, `views`, `likes`, `comments`) VALUES
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(0, 6, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(0, 6, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(0, 6, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(1, 38, 0, 0, 0),
(0, 6, 0, 0, 0);

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

--
-- Structure de la table `q_comments`
--

CREATE TABLE `q_comments` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `video_id` int(11) NOT NULL,
  `comment` text DEFAULT NULL,
  `comment_type` enum('public','private') NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT current_timestamp(),
  `like_count` int(11) DEFAULT 0,
  `dislike_count` int(11) DEFAULT 0,
  `encrypted_comment` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `q_comments`
--

INSERT INTO `q_comments` (`id`, `user_id`, `video_id`, `comment`, `comment_type`, `timestamp`, `like_count`, `dislike_count`, `encrypted_comment`) VALUES
(1, 4, 11, 'Gonna find a way ', 'public', '2025-02-02 10:44:46', 0, 0, NULL),
(2, 4, 11, '', 'private', '2025-02-02 10:45:05', 0, 0, 'ek9nMHJRdUc0S2JZQXIxZFp3aDVoT0F0MWxnMlpxZmNWTGxueEY1Tlhzbz0='),
(3, 4, 11, '', 'private', '2025-02-02 10:45:06', 0, 0, 'ek9nMHJRdUc0S2JZQXIxZFp3aDVoT0F0MWxnMlpxZmNWTGxueEY1Tlhzbz0=');

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

--
-- Structure de la table `saved_videos`
--

CREATE TABLE `saved_videos` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `video_id` int(11) NOT NULL,
  `saved_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure de la table `schedules`
--

CREATE TABLE `schedules` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `schedules`
--

INSERT INTO `schedules` (`id`, `video_id`, `datetime`) VALUES
(1, 9, '2025-01-26 05:05:00'),
(2, 10, '2025-01-26 13:15:00'),
(3, 9, '2025-01-26 14:29:00'),
(4, 10, '2025-01-26 12:45:00'),
(5, 10, '2025-01-26 15:33:00'),
(6, 10, '2025-01-26 15:33:00'),
(7, 10, '2025-01-26 15:33:00'),
(8, 10, '2025-01-26 19:33:00'),
(9, 10, '2025-01-26 19:33:00'),
(10, 9, '2025-01-26 19:09:00'),
(11, 10, '2025-01-26 21:45:00'),
(12, 10, '2025-01-26 11:45:00'),
(13, 10, '2025-01-26 20:45:00'),
(14, 10, '2025-01-26 15:51:00'),
(15, 10, '2025-01-26 15:51:00'),
(16, 10, '2025-01-26 21:51:00'),
(17, 10, '2025-01-26 16:02:00'),
(18, 10, '2025-01-26 18:02:00'),
(19, 9, '2025-01-26 21:02:00'),
(20, 10, '2025-01-26 16:11:00'),
(21, 10, '2025-01-27 07:07:00'),
(22, 10, '2025-01-27 08:24:00'),
(23, 9, '2025-01-27 07:53:00'),
(24, 10, '2025-01-27 18:26:00'),
(25, 15, '2025-01-29 09:00:00'),
(26, 14, '2025-02-01 23:00:00'),
(27, 13, '2025-02-04 10:23:00'),
(28, 15, '2025-02-06 13:30:00');

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

--
-- Structure de la table `statuses`
--

CREATE TABLE `statuses` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `media_type` enum('image','video') DEFAULT NULL,
  `media_url` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `background_color` varchar(7) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure de la table `streams`
--

CREATE TABLE `streams` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `stream_key` varchar(255) NOT NULL,
  `is_live` tinyint(1) DEFAULT 0,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure de la table `user_follow`
--

CREATE TABLE `user_follow` (
  `id` int(11) NOT NULL,
  `follower_id` int(11) NOT NULL,
  `followed_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `user_follow`
--

INSERT INTO `user_follow` (`id`, `follower_id`, `followed_id`) VALUES
(8, 4, 1),
(9, 4, 3),
(10, 4, 6);

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

--
-- Structure de la table `user_metadata`
--

CREATE TABLE `user_metadata` (
  `id` int(11) NOT NULL,
  `label` varchar(200) DEFAULT NULL,
  `content` varchar(200) DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `user_metadata`
--

INSERT INTO `user_metadata` (`id`, `label`, `content`, `user_id`) VALUES
(1, 'sd', 'sds', 1),
(2, 'yo', 'sdafsd', 6),
(3, 'dsfds', 'dsfsdf', 6),
(4, 'sdfsdf', 'dfsdfsd', 6),
(5, 'fsdfsd', 'fdfsd', 6),
(6, 'fsdfsdf', 'sdfdsf', 6),
(7, 'sdfsfsd', 'fsdfsdf', 6),
(8, 'Work', 'CEO at Vitera', 1),
(9, 'Works at', 'Vitera', 1),
(10, 'Education', 'National Advanced School of Post and Telecommunication', 1),
(11, 'Sex', 'Male', 1);

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

--
-- Structure de la table `user_relation`
--

CREATE TABLE `user_relation` (
  `from` int(11) NOT NULL,
  `to` int(11) NOT NULL,
  `status` varchar(1) DEFAULT NULL,
  `since` timestamp NOT NULL DEFAULT current_timestamp(),
  `id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `user_relation`
--

INSERT INTO `user_relation` (`from`, `to`, `status`, `since`, `id`) VALUES
(2, 1, 'F', '2025-03-17 06:22:28', 1),
(2, 2, 'F', '2025-03-17 06:22:30', 2),
(2, 3, 'F', '2025-03-17 06:22:33', 3),
(1, 2, 'F', '2025-03-17 06:24:13', 4),
(3, 2, 'F', '2025-03-17 06:32:08', 5),
(4, 2, 'F', '2025-03-17 06:33:26', 6),
(2, 4, 'F', '2025-03-17 06:34:50', 8);

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

--
-- Structure de la table `user_type`
--

CREATE TABLE `user_type` (
  `id` int(11) NOT NULL,
  `type_name` varchar(30) DEFAULT NULL,
  `permission` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `user_type`
--

INSERT INTO `user_type` (`id`, `type_name`, `permission`) VALUES
(1, 'Normal user', NULL),
(2, 'Admin', '{\'Admin\':1}');

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

--
-- Structure de la table `user_views`
--

CREATE TABLE `user_views` (
  `user_id` bigint(20) NOT NULL,
  `video_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `user_views`
--

INSERT INTO `user_views` (`user_id`, `video_id`) VALUES
(3344, 25),
(3344, 26),
(3344, 29),
(3344, 30),
(37228, 26),
(1442771, 25),
(1442771, 26),
(1442771, 27),
(1442771, 28),
(1442771, 29),
(1442771, 30),
(1442771, 32),
(1442771, 33),
(1442771, 34),
(1442771, 36),
(1442771, 37),
(1442771, 38),
(1442771, 39),
(87053965, 26),
(87053965, 29),
(385792354341325, 25),
(385792354341325, 26),
(385792354341325, 27),
(385792354341325, 28),
(385792354341325, 29),
(385792354341325, 30),
(512404871496927, 25),
(512404871496927, 26),
(512404871496927, 27),
(512404871496927, 28),
(512404871496927, 29),
(512404871496927, 30),
(512404871496927, 32),
(512404871496927, 33),
(512404871496927, 34),
(512404871496927, 35),
(512404871496927, 36),
(512404871496927, 37),
(512404871496927, 38),
(512404871496927, 39),
(3344, 25),
(3344, 26),
(3344, 29),
(3344, 30),
(37228, 26),
(1442771, 25),
(1442771, 26),
(1442771, 27),
(1442771, 28),
(1442771, 29),
(1442771, 30),
(1442771, 32),
(1442771, 33),
(1442771, 34),
(1442771, 36),
(1442771, 37),
(1442771, 38),
(1442771, 39),
(87053965, 26),
(87053965, 29),
(385792354341325, 25),
(385792354341325, 26),
(385792354341325, 27),
(385792354341325, 28),
(385792354341325, 29),
(385792354341325, 30),
(512404871496927, 25),
(512404871496927, 26),
(512404871496927, 27),
(512404871496927, 28),
(512404871496927, 29),
(512404871496927, 30),
(512404871496927, 32),
(512404871496927, 33),
(512404871496927, 34),
(512404871496927, 35),
(512404871496927, 36),
(512404871496927, 37),
(512404871496927, 38),
(512404871496927, 39),
(3344, 25),
(3344, 26),
(3344, 29),
(3344, 30),
(37228, 26),
(1442771, 25),
(1442771, 26),
(1442771, 27),
(1442771, 28),
(1442771, 29),
(1442771, 30),
(1442771, 32),
(1442771, 33),
(1442771, 34),
(1442771, 36),
(1442771, 37),
(1442771, 38),
(1442771, 39),
(87053965, 26),
(87053965, 29),
(385792354341325, 25),
(385792354341325, 26),
(385792354341325, 27),
(385792354341325, 28),
(385792354341325, 29),
(385792354341325, 30),
(512404871496927, 25),
(512404871496927, 26),
(512404871496927, 27),
(512404871496927, 28),
(512404871496927, 29),
(512404871496927, 30),
(512404871496927, 32),
(512404871496927, 33),
(512404871496927, 34),
(512404871496927, 35),
(512404871496927, 36),
(512404871496927, 37),
(512404871496927, 38),
(512404871496927, 39),
(3344, 25),
(3344, 26),
(3344, 29),
(3344, 30),
(37228, 26),
(1442771, 25),
(1442771, 26),
(1442771, 27),
(1442771, 28),
(1442771, 29),
(1442771, 30),
(1442771, 32),
(1442771, 33),
(1442771, 34),
(1442771, 36),
(1442771, 37),
(1442771, 38),
(1442771, 39),
(87053965, 26),
(87053965, 29),
(385792354341325, 25),
(385792354341325, 26),
(385792354341325, 27),
(385792354341325, 28),
(385792354341325, 29),
(385792354341325, 30),
(512404871496927, 25),
(512404871496927, 26),
(512404871496927, 27),
(512404871496927, 28),
(512404871496927, 29),
(512404871496927, 30),
(512404871496927, 32),
(512404871496927, 33),
(512404871496927, 34),
(512404871496927, 35),
(512404871496927, 36),
(512404871496927, 37),
(512404871496927, 38),
(512404871496927, 39),
(1, 0),
(1, 2),
(1, 1),
(6, 2),
(3, 4),
(3, 2),
(1, 4),
(3, 1),
(3, 3),
(1, 5),
(1, 3),
(3, 5),
(6, 5),
(6, 3),
(4, 10),
(4, 14),
(4, 9);

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

--
-- Structure de la table `videos`
--

CREATE TABLE `videos` (
  `id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `filename` varchar(255) NOT NULL,
  `thumbnail` varchar(255) NOT NULL,
  `resolutions` text NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `views` int(11) DEFAULT 0,
  `duration` varchar(8) DEFAULT NULL,
  `video_type` enum('normal','quickie') NOT NULL,
  `upload_date` timestamp NOT NULL DEFAULT current_timestamp(),
  `userid` int(11) DEFAULT NULL,
  `original_video_path` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `videos`
--

INSERT INTO `videos` (`id`, `title`, `description`, `filename`, `thumbnail`, `resolutions`, `created_at`, `views`, `duration`, `video_type`, `upload_date`, `userid`, `original_video_path`) VALUES
(3, 'Jude Bellingham', 'Jude Bellingham', 'video_1742193744069.mp4', '', '{\"240p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193744069_240p_h264.mp4\"},\"360p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193744069_360p_h264.mp4\"},\"480p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193744069_480p_h264.mp4\"},\"720p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193744069_720p_h264.mp4\"},\"1080p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193744069_1080p_h264.mp4\"}}', '2025-03-17 06:43:12', 0, '00:00:19', 'quickie', '2025-03-17 06:43:12', 2, NULL),
(4, 'People dancing ', 'People Dancing ', 'video_1742193928205.mp4', '', '{\"240p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193928205_240p_h264.mp4\"},\"360p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193928205_360p_h264.mp4\"},\"480p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193928205_480p_h264.mp4\"},\"720p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193928205_720p_h264.mp4\"},\"1080p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742193928205_1080p_h264.mp4\"}}', '2025-03-17 06:46:41', 0, '00:00:15', 'quickie', '2025-03-17 06:46:41', 2, NULL),
(6, 'Wizkid: I love my baby ', 'Wizkid: I love my baby ', 'video_1742194736246.mp4', '', '{\"240p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742194736246_240p_h264.mp4\"},\"360p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742194736246_360p_h264.mp4\"},\"480p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742194736246_480p_h264.mp4\"},\"720p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742194736246_720p_h264.mp4\"},\"1080p\":{\"h264\":\"assets\\/php\\/transcoded_videos\\/video_1742194736246_1080p_h264.mp4\"}}', '2025-03-17 07:03:22', 0, '00:04:06', 'normal', '2025-03-17 07:03:22', 2, NULL),
(7, 'Darsy & Evhan  ft Sean Brignton - Mon Coeur fait', 'Darsy & Evhan  ft Sean Brignton - Mon Coeur fait', 'Darsy & Evhan\'s & Sean Bridon & Yaya Vichenzo - Mon Cœur Fait (Clip Officiel).mp4', 'assets/php/thumbnails/darsy.png', '[]', '2025-03-17 07:07:53', 0, '00:04:14', 'normal', '2025-03-17 07:07:53', 4, 'C:/xampp/htdocs/Flausite/assets/php/videos/Darsy & Evhan\'s & Sean Bridon & Yaya Vichenzo - Mon Cœur Fait (Clip Officiel).mp4');

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

--
-- Structure de la table `video_history`
--

CREATE TABLE `video_history` (
  `id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `video_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `thumbnail` varchar(255) NOT NULL,
  `timestamp` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `video_history`
--

INSERT INTO `video_history` (`id`, `user_id`, `video_id`, `title`, `thumbnail`, `timestamp`) VALUES
(1, 4, 10, 'Ali Gatie-Can\'t let you go', 'assets/php/thumbnails/ali.PNG', '2025-01-28 18:54:34'),
(2, 4, 14, 'Kocee- Mama', 'assets/php/thumbnails/Screenshot 2024-11-08 092323.png', '2025-02-04 01:58:41'),
(3, 4, 9, 'Darsy & Evhan  ft Sean Brignton - Mon Coeur fait', 'assets/php/thumbnails/darsy.png', '2025-02-06 15:07:21');

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

--
-- Structure de la table `video_likes`
--

CREATE TABLE `video_likes` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `type` enum('like','dislike') NOT NULL,
  `userid` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Déchargement des données de la table `video_likes`
--

INSERT INTO `video_likes` (`id`, `video_id`, `type`, `userid`) VALUES
(7, 2, 'like', 1),
(8, 2, 'dislike', 1),
(9, 5, 'dislike', 3),
(10, 5, 'like', 3),
(11, 1, 'like', 3),
(12, 9, 'like', 4);

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

--
-- Structure de la table `video_reactions`
--

CREATE TABLE `video_reactions` (
  `id` int(11) NOT NULL,
  `video_id` int(11) NOT NULL,
  `user_id` bigint(20) NOT NULL,
  `reaction_type` enum('like','dislike') NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Structure de la table `writing_message_notifier`
--

CREATE TABLE `writing_message_notifier` (
  `message_writer` int(11) DEFAULT NULL,
  `message_waiter` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Index pour les tables déchargées
--

--
-- Index pour la table `channel`
--
ALTER TABLE `channel`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `cinema_chat`
--
ALTER TABLE `cinema_chat`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `comment`
--
ALTER TABLE `comment`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `comments`
--
ALTER TABLE `comments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `video_id` (`video_id`);

--
-- Index pour la table `contacts`
--
ALTER TABLE `contacts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `user_id` (`user_id`),
  ADD KEY `contact_id` (`contact_id`);

--
-- Index pour la table `dislikes`
--
ALTER TABLE `dislikes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_dislike` (`video_id`,`user_id`),
  ADD KEY `user_id` (`user_id`);

--
-- Index pour la table `invitations`
--
ALTER TABLE `invitations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `friend_id` (`friend_id`),
  ADD KEY `schedule_id` (`schedule_id`);

--
-- Index pour la table `like`
--
ALTER TABLE `like`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_index` (`post_id`,`user_id`);

--
-- Index pour la table `likes`
--
ALTER TABLE `likes`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `message`
--
ALTER TABLE `message`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `message_recipient`
--
ALTER TABLE `message_recipient`
  ADD PRIMARY KEY (`id`),
  ADD KEY `message_id` (`message_id`);

--
-- Index pour la table `post`
--
ALTER TABLE `post`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_post_place` (`post_place`);

--
-- Index pour la table `post_place`
--
ALTER TABLE `post_place`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `post_visibility`
--
ALTER TABLE `post_visibility`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `q_comments`
--
ALTER TABLE `q_comments`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `schedules`
--
ALTER TABLE `schedules`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `user_follow`
--
ALTER TABLE `user_follow`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `follow_unique` (`follower_id`,`followed_id`);

--
-- Index pour la table `user_metadata`
--
ALTER TABLE `user_metadata`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_label_UK` (`label`,`user_id`);

--
-- Index pour la table `user_relation`
--
ALTER TABLE `user_relation`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UNIQUE_RELATION` (`from`,`to`,`status`);

--
-- Index pour la table `user_type`
--
ALTER TABLE `user_type`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `videos`
--
ALTER TABLE `videos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_user_info` (`userid`);

--
-- Index pour la table `video_history`
--
ALTER TABLE `video_history`
  ADD PRIMARY KEY (`id`);

--
-- Index pour la table `video_likes`
--
ALTER TABLE `video_likes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `userid` (`userid`);

--
-- AUTO_INCREMENT pour les tables déchargées
--

--
-- AUTO_INCREMENT pour la table `channel`
--
ALTER TABLE `channel`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=203;

--
-- AUTO_INCREMENT pour la table `cinema_chat`
--
ALTER TABLE `cinema_chat`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT pour la table `comment`
--
ALTER TABLE `comment`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=24;

--
-- AUTO_INCREMENT pour la table `comments`
--
ALTER TABLE `comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79;

--
-- AUTO_INCREMENT pour la table `invitations`
--
ALTER TABLE `invitations`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=49;

--
-- AUTO_INCREMENT pour la table `like`
--
ALTER TABLE `like`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT pour la table `likes`
--
ALTER TABLE `likes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT pour la table `message`
--
ALTER TABLE `message`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT pour la table `message_recipient`
--
ALTER TABLE `message_recipient`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT pour la table `post`
--
ALTER TABLE `post`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT pour la table `post_place`
--
ALTER TABLE `post_place`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT pour la table `post_visibility`
--
ALTER TABLE `post_visibility`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT pour la table `q_comments`
--
ALTER TABLE `q_comments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT pour la table `schedules`
--
ALTER TABLE `schedules`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT pour la table `user_follow`
--
ALTER TABLE `user_follow`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT pour la table `user_metadata`
--
ALTER TABLE `user_metadata`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT pour la table `user_relation`
--
ALTER TABLE `user_relation`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT pour la table `user_type`
--
ALTER TABLE `user_type`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT pour la table `videos`
--
ALTER TABLE `videos`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT pour la table `video_history`
--
ALTER TABLE `video_history`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT pour la table `video_likes`
--
ALTER TABLE `video_likes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- Contraintes pour les tables déchargées
--

--
-- Contraintes pour la table `comments`
--
ALTER TABLE `comments`
  ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user_info` (`id`),
  ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`video_id`) REFERENCES `videos` (`id`);

--
-- Contraintes pour la table `invitations`
--
ALTER TABLE `invitations`
  ADD CONSTRAINT `invitations_ibfk_1` FOREIGN KEY (`friend_id`) REFERENCES `user_info` (`id`),
  ADD CONSTRAINT `invitations_ibfk_2` FOREIGN KEY (`schedule_id`) REFERENCES `schedules` (`id`);

--
-- Contraintes pour la table `post`
--
ALTER TABLE `post`
  ADD CONSTRAINT `fk_post_place` FOREIGN KEY (`post_place`) REFERENCES `post_place` (`id`);
COMMIT;

