text: -- phpMyAdmin SQL Dump
  -- version 5.0.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Dec 11, 2020 at 11:09 PM
  -- Server version: 10.4.11-MariaDB
  -- PHP Version: 7.4.3
  
  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  SET AUTOCOMMIT = 0;
  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 */;
  
  --
  -- Database: `dcmsdb`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `user_id` varchar(6) NOT NULL,
    `access_level` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `app`
  --
  
  CREATE TABLE `app` (
    `content_id` varchar(7) NOT NULL,
    `platform` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `book`
  --
  
  CREATE TABLE `book` (
    `content_id` varchar(7) NOT NULL,
    `author` varchar(24) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `comment`
  --
  
  CREATE TABLE `comment` (
    `comment_id` varchar(8) NOT NULL,
    `user_id` varchar(6) NOT NULL,
    `content_id` varchar(7) NOT NULL,
    `comment_date` datetime NOT NULL,
    `comment` text NOT NULL,
    `approved` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `content`
  --
  
  CREATE TABLE `content` (
    `content_id` varchar(7) NOT NULL,
    `content_name` varchar(64) NOT NULL,
    `release_date` datetime NOT NULL,
    `thumbnail` varchar(42) NOT NULL,
    `description` text NOT NULL,
    `price` float(5,2) NOT NULL,
    `user_id` varchar(6) NOT NULL,
    `file_name` varchar(42) NOT NULL,
    `rating` int(1) NOT NULL,
    `tag` text NOT NULL,
    `type` varchar(10) NOT NULL,
    `approved` tinyint(2) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `creator`
  --
  
  CREATE TABLE `creator` (
    `user_id` varchar(6) NOT NULL,
    `description` text NOT NULL,
    `profession` char(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `customer`
  --
  
  CREATE TABLE `customer` (
    `user_id` varchar(6) NOT NULL,
    `preference` text NOT NULL,
    `download` mediumtext NOT NULL,
    `subscription` mediumtext NOT NULL,
    `favorite` mediumtext NOT NULL,
    `wishlist` mediumtext NOT NULL,
    `payed_content` mediumtext NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `image`
  --
  
  CREATE TABLE `image` (
    `content_id` varchar(7) NOT NULL,
    `width` int(4) NOT NULL,
    `height` int(4) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `music`
  --
  
  CREATE TABLE `music` (
    `content_id` varchar(7) NOT NULL,
    `length` varchar(10) NOT NULL,
    `heard` int(12) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `user_id` varchar(6) NOT NULL,
    `user_name` varchar(24) NOT NULL,
    `first_name` varchar(24) NOT NULL,
    `last_name` varchar(24) NOT NULL,
    `phone_number` varchar(13) NOT NULL,
    `email` varchar(64) NOT NULL,
    `password` varchar(32) NOT NULL,
    `type` char(1) NOT NULL,
    `profile_image` varchar(24) NOT NULL,
    `status` varchar(10) NOT NULL,
    `reset_code` int(5) NOT NULL,
    `balance` float NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `video`
  --
  
  CREATE TABLE `video` (
    `content_id` varchar(7) NOT NULL,
    `view` varchar(10) NOT NULL,
    `length` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD KEY `admin_ibfk_1` (`user_id`);
  
  --
  -- Indexes for table `app`
  --
  ALTER TABLE `app`
    ADD KEY `app_ibfk_1` (`content_id`);
  
  --
  -- Indexes for table `book`
  --
  ALTER TABLE `book`
    ADD KEY `book_ibfk_1` (`content_id`);
  
  --
  -- Indexes for table `comment`
  --
  ALTER TABLE `comment`
    ADD KEY `comment_ibfk_1` (`content_id`),
    ADD KEY `comment_ibfk_2` (`user_id`);
  
  --
  -- Indexes for table `content`
  --
  ALTER TABLE `content`
    ADD PRIMARY KEY (`content_id`),
    ADD KEY `content_ibfk_1` (`user_id`);
  
  --
  -- Indexes for table `creator`
  --
  ALTER TABLE `creator`
    ADD KEY `creator_ibfk_1` (`user_id`);
  
  --
  -- Indexes for table `customer`
  --
  ALTER TABLE `customer`
    ADD KEY `customer_ibfk_1` (`user_id`);
  
  --
  -- Indexes for table `image`
  --
  ALTER TABLE `image`
    ADD KEY `image_ibfk_1` (`content_id`);
  
  --
  -- Indexes for table `music`
  --
  ALTER TABLE `music`
    ADD KEY `music_ibfk_1` (`content_id`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`user_id`);
  
  --
  -- Indexes for table `video`
  --
  ALTER TABLE `video`
    ADD KEY `video_ibfk_1` (`content_id`);
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `admin`
  --
  ALTER TABLE `admin`
    ADD CONSTRAINT `admin_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `app`
  --
  ALTER TABLE `app`
    ADD CONSTRAINT `app_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `book`
  --
  ALTER TABLE `book`
    ADD CONSTRAINT `book_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `comment`
  --
  ALTER TABLE `comment`
    ADD CONSTRAINT `comment_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE,
    ADD CONSTRAINT `comment_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `content`
  --
  ALTER TABLE `content`
    ADD CONSTRAINT `content_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `creator`
  --
  ALTER TABLE `creator`
    ADD CONSTRAINT `creator_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `customer`
  --
  ALTER TABLE `customer`
    ADD CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `image`
  --
  ALTER TABLE `image`
    ADD CONSTRAINT `image_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `music`
  --
  ALTER TABLE `music`
    ADD CONSTRAINT `music_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Constraints for table `video`
  --
  ALTER TABLE `video`
    ADD CONSTRAINT `video_ibfk_1` FOREIGN KEY (`content_id`) REFERENCES `content` (`content_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  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 */;
  