-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
120 lines (105 loc) · 5.71 KB
/
db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
-- MySQL dump 10.13 Distrib 5.7.23, for Win64 (x86_64)
--
-- Host: localhost Database: zooalist
-- ------------------------------------------------------
-- Server version 5.7.23
/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`status` enum('pending','active','deleted','banned') NOT NULL DEFAULT 'pending',
`email` varchar(255) NOT NULL,
`password` binary(60) NOT NULL,
`firstname` varchar(100) NOT NULL,
`lastname` varchar(100) NOT NULL,
`role` enum('user','admin') NOT NULL DEFAULT 'user',
`modified` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`),
UNIQUE KEY `users_email_idx` (`email`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` (`user_id`, `status`, `email`, `password`, `firstname`, `lastname`, `role`, `modified`, `created`) VALUES (2,'active','[email protected]',_binary '$2y$10$EtmoK34zNgfsyo4QC8Hlxe4BAjzTUvbHL6NiuSPG06mKSVu85JkU6','Israel','Vainberg','user',NULL,'2019-05-09 09:31:39'),(3,'active','[email protected]',_binary '$2y$10$Un5QLhaG.5Btijay2iVDCO6XjFnS7Lt8pidZpsyc5FOYXjsESpXea','Pika','Zvik','user',NULL,'2019-05-11 14:37:16'),(4,'active','[email protected]',_binary '$2y$10$Hz4YfR63m/96iNvTsY8YtuPYqclNsRm9I3sTo6r7f33rECJucgFVq','Toca','Toca','user',NULL,'2019-05-11 14:37:55'),(5,'active','[email protected]',_binary '$2y$10$p9Jj.ChjHGquVUgzc4KSVuEqkjQqiTTSeRxinoXLheolIqR7miu0O','Voo','Vue','user',NULL,'2019-05-12 11:45:48');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
--
-- Table structure for table `friends`
--
DROP TABLE IF EXISTS `friends`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `friends` (
`friends_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`friend_id` int(11) NOT NULL,
`status` enum('pending','active','deleted') NOT NULL DEFAULT 'pending',
`modified` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`friends_id`),
UNIQUE KEY `friends_user_id_friend_id_unique_idx` (`user_id`,`friend_id`),
KEY `friends_user_id_idx` (`user_id`),
KEY `friends_friend_id_idx` (`friend_id`),
CONSTRAINT `friends_friend_id_fk` FOREIGN KEY (`friend_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `friends_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `friends`
--
LOCK TABLES `friends` WRITE;
/*!40000 ALTER TABLE `friends` DISABLE KEYS */;
INSERT INTO `friends` (`friends_id`, `user_id`, `friend_id`, `status`, `modified`, `created`) VALUES (1,2,3,'active',NULL,'2019-05-11 14:39:53'),(2,4,2,'pending',NULL,'2019-05-11 14:39:53'),(3,3,4,'active',NULL,'2019-05-12 06:59:18'),(4,5,2,'active','2019-05-12 12:28:12','2019-05-12 12:05:39');
/*!40000 ALTER TABLE `friends` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `posts`
--
DROP TABLE IF EXISTS `posts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `posts` (
`post_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`content` text NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`post_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `posts_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `posts`
--
LOCK TABLES `posts` WRITE;
/*!40000 ALTER TABLE `posts` DISABLE KEYS */;
INSERT INTO `posts` (`post_id`, `user_id`, `content`, `created`) VALUES (1,3,'This is My First post','2019-05-12 08:34:21'),(2,3,'This is my second post. as you can see i dont wait for a long time to write something else','2019-05-12 08:35:01'),(3,2,'My cool reply','2019-05-12 09:06:29'),(4,5,'This is my post friends','2019-05-12 12:06:35'),(5,5,'This is another post','2019-05-12 12:08:24');
/*!40000 ALTER TABLE `posts` ENABLE KEYS */;
UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-05-12 16:23:09