text: -- phpMyAdmin SQL Dump
  -- version 4.8.4
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Sep 30, 2019 at 04:15 AM
  -- Server version: 10.1.37-MariaDB
  -- PHP Version: 7.3.0
  
  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: `chat`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `friendlist`
  --
  
  CREATE TABLE `friendlist` (
    `id` int(11) NOT NULL,
    `FK_User` int(11) NOT NULL,
    `FK_userfriend` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `message`
  --
  
  CREATE TABLE `message` (
    `id` int(11) NOT NULL,
    `message` varchar(555) NOT NULL,
    `FK_User` int(11) NOT NULL,
    `FK_User_To` int(11) NOT NULL,
    `isSent` tinyint(1) NOT NULL,
    `isDelivered` tinyint(1) NOT NULL,
    `isSeen` tinyint(1) NOT NULL,
    `DeleteLevel` tinyint(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `userfriendlistmessage`
  --
  
  CREATE TABLE `userfriendlistmessage` (
    `id` int(11) NOT NULL,
    `FK_User` int(11) NOT NULL,
    `FK_friendlist` int(11) NOT NULL,
    `FK_Message` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `users`
  --
  
  CREATE TABLE `users` (
    `id` int(11) NOT NULL,
    `name` varchar(555) NOT NULL,
    `email` varchar(555) NOT NULL,
    `password` varchar(555) NOT NULL,
    `gender` tinyint(4) NOT NULL,
    `phone` varchar(15) NOT NULL,
    `isActive` tinyint(1) NOT NULL,
    `isDelete` tinyint(1) NOT NULL,
    `isOnline` tinyint(1) NOT NULL,
    `LastOnline` datetime NOT NULL,
    `profilePic` varchar(555) DEFAULT NULL,
    `isAdmin` tinyint(1) NOT NULL DEFAULT '0',
    `createDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `users`
  --
  
  INSERT INTO `users` (`id`, `name`, `email`, `password`, `gender`, `phone`, `isActive`, `isDelete`, `isOnline`, `LastOnline`, `profilePic`, `isAdmin`, `createDate`) VALUES
  (1, 'admin', 'admin@gmail.com', 'admin', 0, '03402087662', 1, 0, 1, '2019-09-22 07:57:11', NULL, 1, '2019-09-22 02:58:09');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `friendlist`
  --
  ALTER TABLE `friendlist`
    ADD PRIMARY KEY (`id`),
    ADD KEY `FK_User` (`FK_User`),
    ADD KEY `FK_userfriend` (`FK_userfriend`);
  
  --
  -- Indexes for table `message`
  --
  ALTER TABLE `message`
    ADD PRIMARY KEY (`id`),
    ADD KEY `FK_User` (`FK_User`),
    ADD KEY `FK_User_To` (`FK_User_To`);
  
  --
  -- Indexes for table `userfriendlistmessage`
  --
  ALTER TABLE `userfriendlistmessage`
    ADD PRIMARY KEY (`id`),
    ADD KEY `FK_User` (`FK_User`),
    ADD KEY `FK_User_2` (`FK_User`),
    ADD KEY `FK_friendlist` (`FK_friendlist`),
    ADD KEY `FK_Message` (`FK_Message`);
  
  --
  -- Indexes for table `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `friendlist`
  --
  ALTER TABLE `friendlist`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `message`
  --
  ALTER TABLE `message`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `userfriendlistmessage`
  --
  ALTER TABLE `userfriendlistmessage`
    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=2;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `friendlist`
  --
  ALTER TABLE `friendlist`
    ADD CONSTRAINT `friendlist_ibfk_1` FOREIGN KEY (`FK_User`) REFERENCES `users` (`id`),
    ADD CONSTRAINT `friendlist_ibfk_2` FOREIGN KEY (`FK_userfriend`) REFERENCES `friendlist` (`id`);
  
  --
  -- Constraints for table `message`
  --
  ALTER TABLE `message`
    ADD CONSTRAINT `message_ibfk_1` FOREIGN KEY (`FK_User`) REFERENCES `users` (`id`),
    ADD CONSTRAINT `message_ibfk_2` FOREIGN KEY (`FK_User_To`) REFERENCES `users` (`id`);
  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 */;
  