-- phpMyAdmin SQL Dump -- version 4.3.9 -- http://www.phpmyadmin.net -- -- Host: sql -- Generation Time: Mar 02, 2019 at 10:25 AM -- Server version: 5.5.60-0+deb8u1 -- PHP Version: 5.6.38-0+deb8u1 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 utf8 */; -- -- Database: `freepost_freepost` -- CREATE DATABASE IF NOT EXISTS `freepost_freepost` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE `freepost_freepost`; -- -------------------------------------------------------- -- -- Table structure for table `comment` -- -- Creation: Jul 03, 2017 at 03:39 PM -- DROP TABLE IF EXISTS `comment`; CREATE TABLE IF NOT EXISTS `comment` ( `id` int(11) NOT NULL, `hashId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `dateCreated` date NOT NULL, `read` tinyint(1) NOT NULL, `text` longtext COLLATE utf8_unicode_ci NOT NULL, `vote` int(11) NOT NULL, `parentId` int(11) DEFAULT NULL, `parentUserId` int(11) DEFAULT NULL, `postId` int(11) DEFAULT NULL, `userId` int(11) DEFAULT NULL ) ENGINE=InnoDB AUTO_INCREMENT=11235 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `post` -- -- Creation: Nov 25, 2017 at 04:35 AM -- DROP TABLE IF EXISTS `post`; CREATE TABLE IF NOT EXISTS `post` ( `id` int(11) NOT NULL, `hashId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `dateCreated` date NOT NULL, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `link` text COLLATE utf8_unicode_ci, `text` longtext COLLATE utf8_unicode_ci NOT NULL, `vote` int(11) NOT NULL, `commentsCount` int(11) NOT NULL, `userId` int(11) DEFAULT NULL ) ENGINE=InnoDB AUTO_INCREMENT=13821 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `remember_me` -- -- Creation: Jul 03, 2017 at 03:39 PM -- DROP TABLE IF EXISTS `remember_me`; CREATE TABLE IF NOT EXISTS `remember_me` ( `token` char(128) COLLATE utf8_unicode_ci NOT NULL, `userId` int(10) NOT NULL, `expires` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Used for user authentication (keep session alive for returning user)'; -- -------------------------------------------------------- -- -- Table structure for table `topic` -- -- Creation: Jul 17, 2018 at 05:50 AM -- DROP TABLE IF EXISTS `topic`; CREATE TABLE IF NOT EXISTS `topic` ( `post_id` int(11) NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Topic name' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `user` -- -- Creation: Jan 11, 2019 at 08:29 PM -- DROP TABLE IF EXISTS `user`; CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) NOT NULL, `hashId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email_notifications` tinyint(1) unsigned NOT NULL DEFAULT '1', `isActive` tinyint(1) NOT NULL, `password` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `passwordResetToken` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `passwordResetTokenExpire` datetime DEFAULT NULL, `registered` datetime NOT NULL, `salt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `about` varchar(10000) COLLATE utf8_unicode_ci NOT NULL DEFAULT '', `session` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Stores the hash value of the session_id random string that was assigned to a user (and saved to a cookie) when logging in.', `preferred_feed` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'hot' ) ENGINE=InnoDB AUTO_INCREMENT=341 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `vote_comment` -- -- Creation: Jul 03, 2017 at 03:39 PM -- DROP TABLE IF EXISTS `vote_comment`; CREATE TABLE IF NOT EXISTS `vote_comment` ( `vote` smallint(6) NOT NULL, `datetime` datetime NOT NULL, `commentId` int(11) NOT NULL, `userId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table `vote_post` -- -- Creation: Jul 03, 2017 at 03:39 PM -- DROP TABLE IF EXISTS `vote_post`; CREATE TABLE IF NOT EXISTS `vote_post` ( `vote` smallint(6) NOT NULL, `datetime` datetime NOT NULL, `postId` int(11) NOT NULL, `userId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Indexes for dumped tables -- -- -- Indexes for table `comment` -- ALTER TABLE `comment` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `hashId` (`hashId`), ADD KEY `IDX_9474526C10EE4CEE` (`parentId`), ADD KEY `IDX_9474526C251330C5` (`parentUserId`), ADD KEY `IDX_9474526CE094D20D` (`postId`), ADD KEY `IDX_9474526C64B64DCC` (`userId`), ADD KEY `created` (`created`), ADD KEY `dateCreated` (`dateCreated`), ADD KEY `isRead` (`read`), ADD KEY `vote` (`vote`); -- -- Indexes for table `post` -- ALTER TABLE `post` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `hashId` (`hashId`), ADD KEY `IDX_5A8A6C8D64B64DCC` (`userId`), ADD KEY `created` (`created`), ADD KEY `dateCreated` (`dateCreated`), ADD KEY `vote` (`vote`); -- -- Indexes for table `remember_me` -- ALTER TABLE `remember_me` ADD PRIMARY KEY (`token`), ADD KEY `userId` (`userId`); -- -- Indexes for table `topic` -- ALTER TABLE `topic` ADD PRIMARY KEY (`post_id`,`name`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `hashId` (`hashId`), ADD UNIQUE KEY `username` (`username`), ADD UNIQUE KEY `email` (`email`), ADD UNIQUE KEY `passwordResetCode` (`passwordResetToken`), ADD UNIQUE KEY `session` (`session`); -- -- Indexes for table `vote_comment` -- ALTER TABLE `vote_comment` ADD PRIMARY KEY (`commentId`,`userId`), ADD KEY `IDX_1FC60DF46690C3F5` (`commentId`), ADD KEY `IDX_1FC60DF464B64DCC` (`userId`); -- -- Indexes for table `vote_post` -- ALTER TABLE `vote_post` ADD PRIMARY KEY (`postId`,`userId`), ADD KEY `IDX_EDE89DBCE094D20D` (`postId`), ADD KEY `IDX_EDE89DBC64B64DCC` (`userId`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `comment` -- ALTER TABLE `comment` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=11235; -- -- AUTO_INCREMENT for table `post` -- ALTER TABLE `post` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=13821; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=341; -- -- Constraints for dumped tables -- -- -- Constraints for table `comment` -- ALTER TABLE `comment` ADD CONSTRAINT `FK_9474526C10EE4CEE` FOREIGN KEY (`parentId`) REFERENCES `comment` (`id`), ADD CONSTRAINT `FK_9474526C251330C5` FOREIGN KEY (`parentUserId`) REFERENCES `user` (`id`), ADD CONSTRAINT `FK_9474526C64B64DCC` FOREIGN KEY (`userId`) REFERENCES `user` (`id`), ADD CONSTRAINT `FK_9474526CE094D20D` FOREIGN KEY (`postId`) REFERENCES `post` (`id`); -- -- Constraints for table `post` -- ALTER TABLE `post` ADD CONSTRAINT `FK_5A8A6C8D64B64DCC` FOREIGN KEY (`userId`) REFERENCES `user` (`id`); -- -- Constraints for table `remember_me` -- ALTER TABLE `remember_me` ADD CONSTRAINT `FK_userId` FOREIGN KEY (`userId`) REFERENCES `user` (`id`); -- -- Constraints for table `topic` -- ALTER TABLE `topic` ADD CONSTRAINT `fk_topic_1` FOREIGN KEY (`post_id`) REFERENCES `post` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `vote_comment` -- ALTER TABLE `vote_comment` ADD CONSTRAINT `FK_1FC60DF464B64DCC` FOREIGN KEY (`userId`) REFERENCES `user` (`id`), ADD CONSTRAINT `FK_1FC60DF46690C3F5` FOREIGN KEY (`commentId`) REFERENCES `comment` (`id`); -- -- Constraints for table `vote_post` -- ALTER TABLE `vote_post` ADD CONSTRAINT `FK_EDE89DBC64B64DCC` FOREIGN KEY (`userId`) REFERENCES `user` (`id`), ADD CONSTRAINT `FK_EDE89DBCE094D20D` FOREIGN KEY (`postId`) REFERENCES `post` (`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 */;