· 7 years ago · Dec 30, 2018, 11:14 PM
1DROP TABLE IF EXISTS `groups`;
2
3#
4# Table structure for table 'groups'
5#
6
7CREATE TABLE `groups` (
8 `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
9 `name` varchar(20) NOT NULL,
10 `description` varchar(100) NOT NULL,
11 PRIMARY KEY (`id`)
12) ENGINE=InnoDB DEFAULT CHARSET=utf8;
13
14#
15# Dumping data for table 'groups'
16#
17
18INSERT INTO `groups` (`id`, `name`, `description`) VALUES
19 (1,'admin','Administrator'),
20 (2,'members','General User');
21
22
23
24DROP TABLE IF EXISTS `users`;
25
26#
27# Table structure for table 'users'
28#
29
30CREATE TABLE `users` (
31 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
32 `ip_address` varchar(45) NOT NULL,
33 `username` varchar(100) NULL,
34 `password` varchar(255) NOT NULL,
35 `email` varchar(254) NOT NULL,
36 `activation_selector` varchar(255) DEFAULT NULL,
37 `activation_code` varchar(255) DEFAULT NULL,
38 `forgotten_password_selector` varchar(255) DEFAULT NULL,
39 `forgotten_password_code` varchar(255) DEFAULT NULL,
40 `forgotten_password_time` int(11) unsigned DEFAULT NULL,
41 `remember_selector` varchar(255) DEFAULT NULL,
42 `remember_code` varchar(255) DEFAULT NULL,
43 `created_on` int(11) unsigned NOT NULL,
44 `last_login` int(11) unsigned DEFAULT NULL,
45 `active` tinyint(1) unsigned DEFAULT NULL,
46 `first_name` varchar(50) DEFAULT NULL,
47 `last_name` varchar(50) DEFAULT NULL,
48 `company` varchar(100) DEFAULT NULL,
49 `phone` varchar(20) DEFAULT NULL,
50 PRIMARY KEY (`id`),
51 CONSTRAINT `uc_email` UNIQUE (`email`),
52 CONSTRAINT `uc_activation_selector` UNIQUE (`activation_selector`),
53 CONSTRAINT `uc_forgotten_password_selector` UNIQUE (`forgotten_password_selector`),
54 CONSTRAINT `uc_remember_selector` UNIQUE (`remember_selector`)
55) ENGINE=InnoDB DEFAULT CHARSET=utf8;
56
57
58#
59# Dumping data for table 'users'
60#
61
62INSERT INTO `users` (`id`, `ip_address`, `username`, `password`, `email`, `activation_code`, `forgotten_password_code`, `created_on`, `last_login`, `active`, `first_name`, `last_name`, `company`, `phone`) VALUES
63 ('1','127.0.0.1','administrator','$2y$08$200Z6ZZbp3RAEXoaWcMA6uJOFicwNZaqk4oDhqTUiFXFe63MG.Daa','admin@admin.com','',NULL,'1268889823','1268889823','1', 'Admin','istrator','ADMIN','0');
64
65
66DROP TABLE IF EXISTS `users_groups`;
67
68#
69# Table structure for table 'users_groups'
70#
71
72CREATE TABLE `users_groups` (
73 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
74 `user_id` int(11) unsigned NOT NULL,
75 `group_id` mediumint(8) unsigned NOT NULL,
76 PRIMARY KEY (`id`),
77 KEY `fk_users_groups_users1_idx` (`user_id`),
78 KEY `fk_users_groups_groups1_idx` (`group_id`),
79 CONSTRAINT `uc_users_groups` UNIQUE (`user_id`, `group_id`),
80 CONSTRAINT `fk_users_groups_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
81 CONSTRAINT `fk_users_groups_groups1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
82) ENGINE=InnoDB DEFAULT CHARSET=utf8;
83
84INSERT INTO `users_groups` (`id`, `user_id`, `group_id`) VALUES
85 (1,1,1),
86 (2,1,2);
87
88
89DROP TABLE IF EXISTS `login_attempts`;
90
91#
92# Table structure for table 'login_attempts'
93#
94
95CREATE TABLE `login_attempts` (
96 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
97 `ip_address` varchar(45) NOT NULL,
98 `login` varchar(100) NOT NULL,
99 `time` int(11) unsigned DEFAULT NULL,
100 PRIMARY KEY (`id`)
101) ENGINE=InnoDB DEFAULT CHARSET=utf8;