-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathskeleton_database.sql
More file actions
145 lines (104 loc) · 5.54 KB
/
skeleton_database.sql
File metadata and controls
145 lines (104 loc) · 5.54 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
SQLyog Ultimate v11.11 (64 bit)
MySQL - 5.7.11 : Database - skeleton_database
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!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 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`skeleton_database` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `skeleton_database`;
/*Table structure for table `skel_sessions` */
DROP TABLE IF EXISTS `skel_sessions`;
CREATE TABLE `skel_sessions` (
`id` varchar(40) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `skel_sessions` */
/*Table structure for table `groups` */
DROP TABLE IF EXISTS `groups`;
CREATE TABLE `groups` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`description` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `groups` */
insert into `groups`(`id`,`name`,`description`) values (1,'admin','Administrator'),(2,'members','General User');
/*Table structure for table `login_attempts` */
DROP TABLE IF EXISTS `login_attempts`;
CREATE TABLE `login_attempts` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_address` varchar(45) NOT NULL,
`login` varchar(100) NOT NULL,
`time` int(11) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*Data for the table `login_attempts` */
insert into `login_attempts`(`id`,`ip_address`,`login`,`time`) values (2,'::1','admin',1512984040),(3,'::1','admin',1512984047);
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ip_address` varchar(45) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`salt` varchar(255) DEFAULT NULL,
`email` varchar(254) NOT NULL,
`activation_code` varchar(40) DEFAULT NULL,
`forgotten_password_code` varchar(40) DEFAULT NULL,
`forgotten_password_time` int(11) unsigned DEFAULT NULL,
`remember_code` varchar(40) DEFAULT NULL,
`created_on` int(11) unsigned NOT NULL,
`last_login` int(11) unsigned DEFAULT NULL,
`active` tinyint(1) unsigned DEFAULT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*Data for the table `users` */
insert into `users`(`id`,`ip_address`,`username`,`password`,`salt`,`email`,`activation_code`,`forgotten_password_code`,`forgotten_password_time`,`remember_code`,`created_on`,`last_login`,`active`,`first_name`,`last_name`,`phone`) values (1,'127.0.0.1','administrator','$2a$07$SeBknntpZror9uyftVopmu61qg0ms8Qv1yV6FG.kQOSM.9QhmTo36','','admin@admin.com','',NULL,NULL,NULL,1268889823,1512985010,1,'System','Administrator','01234567'),(2,'::1','anoerman','$2y$08$7Y5JK.V54tQ4XrC.xft/SeYtHcqqUrMrV4J7PtY2jNVNDLvifBRmS',NULL,'noerman.agustiyan@gmail.com',NULL,NULL,NULL,NULL,1512716561,NULL,1,'Noerman','Agustiyan','');
/*Table structure for table `users_groups` */
DROP TABLE IF EXISTS `users_groups`;
CREATE TABLE `users_groups` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`group_id` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uc_users_groups` (`user_id`,`group_id`),
KEY `fk_users_groups_users1_idx` (`user_id`),
KEY `fk_users_groups_groups1_idx` (`group_id`),
CONSTRAINT `fk_users_groups_groups1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `fk_users_groups_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*Data for the table `users_groups` */
insert into `users_groups`(`id`,`user_id`,`group_id`) values (5,1,1),(6,1,2),(7,2,2);
/*Table structure for table `users_photo` */
DROP TABLE IF EXISTS `users_photo`;
CREATE TABLE `users_photo` (
`username` varchar(100) NOT NULL,
`photo` text,
`thumbnail` text,
`updated_on` datetime NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*Data for the table `users_photo` */
insert into `users_photo`(`username`,`photo`,`thumbnail`,`updated_on`) values ('administrator','ADMINISTRATOR.jpg','ADMINISTRATOR_thumb.jpg','2017-12-08 14:02:41'),('anoerman','no_picture.png','no_picture.png','2017-12-08 14:04:05');
/* Trigger structure for table `users` */
DELIMITER $$
/*!50003 DROP TRIGGER*//*!50032 IF EXISTS */ /*!50003 `after_users_insert` */$$
/*!50003 CREATE */ /*!50017 DEFINER = 'root'@'localhost' */ /*!50003 TRIGGER `after_users_insert` AFTER INSERT ON `users` FOR EACH ROW BEGIN
INSERT INTO `skel_database`.users_photo VALUES( NEW.username, "no_picture.png", "no_picture.png", now());
END */$$
DELIMITER ;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;