-- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Nov 17, 2019 at 03:19 PM
-- Server version: 10.1.36-MariaDB
-- PHP Version: 7.2.10
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: `reeceflix`
--
-- --------------------------------------------------------
--
-- Table structure for table `billingDetails`
--
CREATE TABLE `billingDetails` (
`id` int(11) NOT NULL,
`agreementId` varchar(200) NOT NULL,
`nextBillingDate` varchar(50) NOT NULL,
`token` varchar(50) NOT NULL,
`username` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `categories`
--
CREATE TABLE `categories` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `entities`
--
CREATE TABLE `entities` (
`id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`thumbnail` varchar(250) NOT NULL,
`preview` varchar(250) NOT NULL,
`categoryId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`firstName` varchar(25) NOT NULL,
`lastName` varchar(25) NOT NULL,
`username` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`password` varchar(255) NOT NULL,
`signUpDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`isSubscribed` tinyint(4) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `videoProgress`
--
CREATE TABLE `videoProgress` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`videoId` int(11) NOT NULL,
`progress` int(11) NOT NULL DEFAULT '0',
`finished` tinyint(4) NOT NULL DEFAULT '0',
`dateModified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `videos`
--
CREATE TABLE `videos` (
`id` int(11) NOT NULL,
`title` varchar(70) NOT NULL,
`description` varchar(1000) NOT NULL,
`filePath` varchar(250) NOT NULL,
`isMovie` tinyint(1) NOT NULL,
`uploadDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`releaseDate` date NOT NULL,
`views` int(11) NOT NULL DEFAULT '0',
`duration` varchar(10) NOT NULL,
`season` int(11) DEFAULT '0',
`episode` int(11) DEFAULT '0',
`entityId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `billingDetails`
--
ALTER TABLE `billingDetails`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `entities`
--
ALTER TABLE `entities`
ADD PRIMARY KEY (`id`),
ADD KEY `categoryId` (`categoryId`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `videoProgress`
--
ALTER TABLE `videoProgress`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `videos`
--
ALTER TABLE `videos`
ADD PRIMARY KEY (`id`),
ADD KEY `entityId` (`entityId`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `billingDetails`
--
ALTER TABLE `billingDetails`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `entities`
--
ALTER TABLE `entities`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `videoProgress`
--
ALTER TABLE `videoProgress`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `videos`
--
ALTER TABLE `videos`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `entities`
--
ALTER TABLE `entities`
ADD CONSTRAINT `entities_ibfk_1` FOREIGN KEY (`categoryId`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `videos`
--
ALTER TABLE `videos`
ADD CONSTRAINT `videos_ibfk_1` FOREIGN KEY (`entityId`) REFERENCES `entities` (`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 */;
|