Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- phpMyAdmin SQL Dump
- -- version 4.6.4
- -- https://www.phpmyadmin.net/
- --
- -- Host: localhost:8889
- -- Generation Time: Dec 05, 2016 at 02:31 PM
- -- Server version: 5.6.33
- -- PHP Version: 7.0.12
- SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
- SET time_zone = "+00:00";
- --
- -- Database: `evolve`
- --
- -- --------------------------------------------------------
- --
- -- Table structure for table `comments`
- --
- CREATE TABLE `comments` (
- `comment_id` int(11) NOT NULL,
- `post_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `comment_body` text NOT NULL,
- `comment_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `comments`
- --
- INSERT INTO `comments` (`comment_id`, `post_id`, `user_id`, `comment_body`, `comment_timestamp`) VALUES
- (1, 1, 1, 'This is a comment that came from an SQL Database.', '2016-12-05 12:35:41');
- -- --------------------------------------------------------
- --
- -- Table structure for table `likes`
- --
- CREATE TABLE `likes` (
- `like_id` int(11) NOT NULL,
- `comment_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `hasLiked` int(1) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `posts`
- --
- CREATE TABLE `posts` (
- `post_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `post_body` text NOT NULL,
- `post_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `posts`
- --
- INSERT INTO `posts` (`post_id`, `user_id`, `post_body`, `post_timestamp`) VALUES
- (1, 1, 'Hey there, this is sample text that came from a SQL Database.', '2016-12-05 12:34:44');
- -- --------------------------------------------------------
- --
- -- Table structure for table `users`
- --
- CREATE TABLE `users` (
- `user_id` int(10) NOT NULL,
- `user_login` varchar(20) NOT NULL,
- `user_password` varchar(20) NOT NULL,
- `user_email` varchar(30) NOT NULL,
- `display_name` varchar(30) NOT NULL,
- `user_reg_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `users`
- --
- INSERT INTO `users` (`user_id`, `user_login`, `user_password`, `user_email`, `display_name`, `user_reg_date`) VALUES
- (1, 'admin', '1234', 'admin@evolve.com', 'Administrator', '2016-12-05 12:33:29');
- -- --------------------------------------------------------
- --
- -- Table structure for table `votes`
- --
- CREATE TABLE `votes` (
- `vote_id` int(11) NOT NULL,
- `post_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `hasVoted` int(1) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Indexes for dumped tables
- --
- --
- -- Indexes for table `comments`
- --
- ALTER TABLE `comments`
- ADD PRIMARY KEY (`comment_id`),
- ADD KEY `post_id` (`post_id`),
- ADD KEY `user_id` (`user_id`);
- --
- -- Indexes for table `likes`
- --
- ALTER TABLE `likes`
- ADD PRIMARY KEY (`like_id`),
- ADD KEY `comment_id` (`comment_id`),
- ADD KEY `user_id` (`user_id`);
- --
- -- Indexes for table `posts`
- --
- ALTER TABLE `posts`
- ADD PRIMARY KEY (`post_id`),
- ADD KEY `user_id` (`user_id`);
- --
- -- Indexes for table `users`
- --
- ALTER TABLE `users`
- ADD PRIMARY KEY (`user_id`);
- --
- -- Indexes for table `votes`
- --
- ALTER TABLE `votes`
- ADD PRIMARY KEY (`vote_id`),
- ADD KEY `post_id` (`post_id`),
- ADD KEY `user_id` (`user_id`);
- --
- -- AUTO_INCREMENT for dumped tables
- --
- --
- -- AUTO_INCREMENT for table `comments`
- --
- ALTER TABLE `comments`
- MODIFY `comment_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
- --
- -- AUTO_INCREMENT for table `likes`
- --
- ALTER TABLE `likes`
- MODIFY `like_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `posts`
- --
- ALTER TABLE `posts`
- MODIFY `post_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
- --
- -- AUTO_INCREMENT for table `users`
- --
- ALTER TABLE `users`
- MODIFY `user_id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
- --
- -- AUTO_INCREMENT for table `votes`
- --
- ALTER TABLE `votes`
- MODIFY `vote_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- Constraints for dumped tables
- --
- --
- -- Constraints for table `comments`
- --
- ALTER TABLE `comments`
- ADD CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`),
- ADD CONSTRAINT `comments_ibfk_2` FOREIGN KEY (`post_id`) REFERENCES `posts` (`post_id`);
- --
- -- Constraints for table `likes`
- --
- ALTER TABLE `likes`
- ADD CONSTRAINT `likes_ibfk_1` FOREIGN KEY (`comment_id`) REFERENCES `comments` (`comment_id`),
- ADD CONSTRAINT `likes_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
- --
- -- Constraints for table `posts`
- --
- ALTER TABLE `posts`
- ADD CONSTRAINT `posts_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
- --
- -- Constraints for table `votes`
- --
- ALTER TABLE `votes`
- ADD CONSTRAINT `votes_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`post_id`),
- ADD CONSTRAINT `votes_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`);
- -- create the users and grant priveleges to those users
- GRANT SELECT, INSERT, DELETE, UPDATE
- ON evolve.*
- TO admin@localhost
- IDENTIFIED BY '1234';
- GRANT SELECT
- ON users
- TO admin@localhost
- IDENTIFIED BY '1234';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement