-- phpMyAdmin SQL Dump
-- version 4.5.4.1deb2ubuntu1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 21, 2018 at 09:39 AM
-- Server version: 5.7.21-0ubuntu0.16.04.1
-- PHP Version: 7.0.28-0ubuntu0.16.04.1

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `utopia`
--

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

--
-- Table structure for table `book`
--

CREATE TABLE `book` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `author` varchar(100) NOT NULL,
  `course` varchar(50) NOT NULL,
  `price` int(11) NOT NULL DEFAULT '0',
  `health` varchar(200) NOT NULL,
  `owner_id` varchar(50) NOT NULL,
  `imageuploaded` tinyint(1) DEFAULT '0',
  `dispmyname` tinyint(1) DEFAULT '1',
  `dispmyemail` tinyint(1) DEFAULT '1',
  `dispmyphone` tinyint(1) DEFAULT '1',
  `dispmyhostel` tinyint(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `book`
--

INSERT INTO `book` (`id`, `name`, `author`, `course`, `price`, `health`, `owner_id`, `imageuploaded`, `dispmyname`, `dispmyemail`, `dispmyphone`, `dispmyhostel`) VALUES
(2, 'Mathematics for Engineers', 'Rakesh Dube', 'Maths', 230, 'This is a very useful book for engineering freshers. The book is in good condition. Price is negotiable.', 'harshitkedia32@gmail.com', 1, 1, 1, 1, 1),
(3, 'Chemistry basics', 'ZumDahl', 'Chemistry', 310, 'This book is a must have for school science students. All important concepts are described clearly in this book. Important problems are also given.', 'akashsingh1@gmail.com', 1, 1, 1, 1, 1);

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

--
-- Table structure for table `grievance`
--

CREATE TABLE `grievance` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `authority` varchar(100) NOT NULL,
  `health` varchar(200) NOT NULL,
  `location` varchar(200) NOT NULL,
  `owner_id` varchar(50) NOT NULL,
  `imageuploaded` tinyint(1) DEFAULT '0',
  `dispmyname` tinyint(1) DEFAULT '1',
  `dispmyemail` tinyint(1) DEFAULT '1',
  `dispmyphone` tinyint(1) DEFAULT '1',
  `dispmyhostel` tinyint(1) DEFAULT '1',
  `upvotes` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `grievance`
--

INSERT INTO `grievance` (`id`, `name`, `authority`, `health`, `location`, `owner_id`, `imageuploaded`, `dispmyname`, `dispmyemail`, `dispmyphone`, `dispmyhostel`, `upvotes`) VALUES
(1, 'Water shortage for 2 weeks', 'Municipal Corporation', 'The water is not coming for 18 hours. It is very difficult to manage. The authorities should take prompt action.', 'Katpadi', 'harshitkedia32@gmail.com', 1, 1, 1, 1, 1, 0),
(2, 'No Electricity in CMC', 'Municipal Corporation', 'There is no electricity in CMC for 8hrs per day. This is happening for last 10 days. Please take appropriate action.', 'CMC', 'harshit.kedia2015@vit.ac.in', 1, 1, 1, 1, 1, 2),
(3, 'Corruption of govt. officers', 'Chief Minister', 'The officers at the Passport office are asking bribe for making our passports. Please take appropriate actions', 'Katpadi', 'harshitkedia32@gmail.com', 1, 1, 1, 1, 1, 8);

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

--
-- Table structure for table `news`
--

CREATE TABLE `news` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `health` varchar(200) NOT NULL,
  `location` varchar(200) NOT NULL,
  `owner_id` varchar(50) NOT NULL,
  `imageuploaded` tinyint(1) DEFAULT '0',
  `dispmyname` tinyint(1) DEFAULT '1',
  `dispmyemail` tinyint(1) DEFAULT '1',
  `dispmyphone` tinyint(1) DEFAULT '1',
  `dispmyhostel` tinyint(1) DEFAULT '1',
  `upvotes` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `news`
--

INSERT INTO `news` (`id`, `name`, `health`, `location`, `owner_id`, `imageuploaded`, `dispmyname`, `dispmyemail`, `dispmyphone`, `dispmyhostel`, `upvotes`) VALUES
(1, 'Fire in Awastha Apartment', 'A Fire broke out at Awastha Apartment, Karreli, Vellore. No death till now. Hundreds of residents injured. Resue operation needed immediately.', 'Karreli', 'harshitkedia32@gmail.com', 1, 0, 0, 1, 1, 4),
(2, 'Earthquake at Vellore', 'A severe Earthquake occurred in Vellore today. Hundreds of people died and were injured. More details coming soon.', 'Vellore', 'harshit.kedia2015@vit.ac.in', 1, 1, 1, 1, 1, 2);

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

--
-- Table structure for table `recommendation`
--

CREATE TABLE `recommendation` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `authority` varchar(100) NOT NULL,
  `health` varchar(200) NOT NULL,
  `stars` int(11) DEFAULT NULL,
  `location` varchar(200) NOT NULL,
  `owner_id` varchar(50) NOT NULL,
  `imageuploaded` tinyint(1) DEFAULT '0',
  `dispmyname` tinyint(1) DEFAULT '1',
  `dispmyemail` tinyint(1) DEFAULT '1',
  `dispmyphone` tinyint(1) DEFAULT '1',
  `dispmyhostel` tinyint(1) DEFAULT '1',
  `upvotes` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `recommendation`
--

INSERT INTO `recommendation` (`id`, `name`, `authority`, `health`, `stars`, `location`, `owner_id`, `imageuploaded`, `dispmyname`, `dispmyemail`, `dispmyphone`, `dispmyhostel`, `upvotes`) VALUES
(1, 'Golmaal 3 is a great movie!', 'Movies', 'A very comedy movie. Great acting by Ajay Devgan. A must watch. A family entertainment.', 5, 'Park Street', 'harshitkedia32@gmail.com', 1, 1, 1, 1, 1, 3),
(2, 'Great food at Hundred Heritage', 'Restaurants', 'Hundred Heritage is a great place to have awesome food and great atmosphere. A must visit!', 4, 'katpadi', 'harshitkedia32@gmail.com', 1, 1, 1, 1, 1, 2);

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

--
-- Table structure for table `requests`
--

CREATE TABLE `requests` (
  `id` int(11) NOT NULL,
  `from_id` varchar(50) NOT NULL,
  `to_id` varchar(50) NOT NULL,
  `book_id` int(11) NOT NULL,
  `readed` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `requests`
--

INSERT INTO `requests` (`id`, `from_id`, `to_id`, `book_id`, `readed`) VALUES
(1, 'harshit.kedia2015@vit.ac.in', 'harshitkedia32@gmail.com', 2, 0),
(2, 'harshitkedia32@gmail.com', 'akashsingh1@gmail.com', 3, 0),
(3, 'akashsingh1@gmail.com', 'harshitkedia32@gmail.com', 2, 0);

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

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
  `name` varchar(30) NOT NULL,
  `regno` varchar(50) NOT NULL,
  `phone` bigint(11) NOT NULL,
  `password` varchar(60) DEFAULT NULL,
  `block` varchar(100) DEFAULT NULL,
  `roomno` varchar(100) DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`name`, `regno`, `phone`, `password`, `block`, `roomno`) VALUES
('Akash Singh', 'akashsingh1@gmail.com', 9830318188, '$2y$10$yGVYYbIHz5sIh7yK5uFRf.5mEyE/1KRV1JWpFnxCFAd5jekYhdX7K', 'Katpadi', ' '),
('Vinit bodhwani', 'harshit.kedia2015@vit.ac.in', 9831684002, '$2y$10$kIQEtL8gaHb3.ETbZoFdOuJF800uM1iZnvyKwkiKJHlmXQbkFsrbW', 'CMC Vellore', ' '),
('Harshit Kedia', 'harshitkedia32@gmail.com', 9585602122, '$2y$10$qNO94F.bCoZdluQMCgf8we5F.da.yUaP56koqpP70N9w/KcCu/CzC', 'VIT University', ' ');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `book`
--
ALTER TABLE `book`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_id` (`owner_id`);

--
-- Indexes for table `grievance`
--
ALTER TABLE `grievance`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_id` (`owner_id`);

--
-- Indexes for table `news`
--
ALTER TABLE `news`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_id` (`owner_id`);

--
-- Indexes for table `recommendation`
--
ALTER TABLE `recommendation`
  ADD PRIMARY KEY (`id`),
  ADD KEY `owner_id` (`owner_id`);

--
-- Indexes for table `requests`
--
ALTER TABLE `requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `to_id` (`to_id`),
  ADD KEY `from_id` (`from_id`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`regno`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `book`
--
ALTER TABLE `book`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `grievance`
--
ALTER TABLE `grievance`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `news`
--
ALTER TABLE `news`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `recommendation`
--
ALTER TABLE `recommendation`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `requests`
--
ALTER TABLE `requests`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Constraints for dumped tables
--

--
-- Constraints for table `book`
--
ALTER TABLE `book`
  ADD CONSTRAINT `book_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`regno`);

--
-- Constraints for table `grievance`
--
ALTER TABLE `grievance`
  ADD CONSTRAINT `grievance_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`regno`);

--
-- Constraints for table `news`
--
ALTER TABLE `news`
  ADD CONSTRAINT `news_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`regno`);

--
-- Constraints for table `recommendation`
--
ALTER TABLE `recommendation`
  ADD CONSTRAINT `recommendation_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`regno`);

--
-- Constraints for table `requests`
--
ALTER TABLE `requests`
  ADD CONSTRAINT `requests_ibfk_1` FOREIGN KEY (`to_id`) REFERENCES `user` (`regno`),
  ADD CONSTRAINT `requests_ibfk_2` FOREIGN KEY (`from_id`) REFERENCES `user` (`regno`);

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