-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathauth.sql
140 lines (124 loc) · 7.01 KB
/
auth.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.7.17 - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5151
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!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' */;
-- Dumping database structure for auth
CREATE DATABASE IF NOT EXISTS `auth` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `auth`;
-- Dumping structure for table auth.permissions
CREATE TABLE IF NOT EXISTS `permissions` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.permissions: ~6 rows (approximately)
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'delete users', '2017-02-19 23:37:37', '2017-02-19 23:37:56'),
(2, 'manage roles', '2017-02-19 23:37:50', '2017-02-20 00:11:25'),
(3, 'edit users', '2017-02-19 23:38:42', '2017-02-19 23:38:42'),
(4, 'edit admins', '2017-02-19 23:39:39', '2017-02-19 23:39:39'),
(5, 'view admin pages', '2017-02-20 00:20:18', '2017-02-20 00:20:18'),
(6, 'make admin', '2017-02-20 00:31:23', '2017-02-20 00:31:23');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
-- Dumping structure for table auth.roles
CREATE TABLE IF NOT EXISTS `roles` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(50) NOT NULL,
`hidden` tinyint(1) NOT NULL DEFAULT '0',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.roles: ~2 rows (approximately)
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` (`id`, `title`, `hidden`, `created_at`, `updated_at`) VALUES
(1, 'admin', '0', '2017-02-19 23:37:00', '2017-02-19 23:37:02'),
(2, 'superadmin', '1', '2017-02-19 23:37:09', '2017-02-19 23:37:14');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
-- Dumping structure for table auth.roles_permissions
CREATE TABLE IF NOT EXISTS `roles_permissions` (
`role_id` int(10) unsigned NOT NULL,
`permission_id` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`role_id`,`permission_id`),
KEY `roles_permissions_permission_foreign_key` (`permission_id`),
CONSTRAINT `roles_permissions_permission_foreign_key` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `roles_permissions_role_foreign_key` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.roles_permissions: ~9 rows (approximately)
/*!40000 ALTER TABLE `roles_permissions` DISABLE KEYS */;
INSERT INTO `roles_permissions` (`role_id`, `permission_id`, `created_at`, `updated_at`) VALUES
(1, 1, '2017-02-20 00:34:50', '2017-02-20 00:34:50'),
(1, 3, '2017-02-19 23:38:49', '2017-02-19 23:38:49'),
(1, 5, '2017-02-20 00:20:36', '2017-02-20 00:20:36'),
(2, 1, '2017-02-19 23:38:20', '2017-02-19 23:38:20'),
(2, 2, '2017-02-19 23:38:25', '2017-02-19 23:38:25'),
(2, 3, '2017-02-20 00:13:12', '2017-02-20 00:13:12'),
(2, 4, '2017-02-19 23:39:58', '2017-02-19 23:39:58'),
(2, 5, '2017-02-20 00:20:44', '2017-02-20 00:20:44'),
(2, 6, '2017-02-20 00:31:32', '2017-02-20 00:31:32');
/*!40000 ALTER TABLE `roles_permissions` ENABLE KEYS */;
-- Dumping structure for table auth.users
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`active` tinyint(1) NOT NULL DEFAULT '0',
`active_hash` varchar(255) DEFAULT NULL,
`remember_token` varchar(255) DEFAULT NULL,
`remember_identifier` varchar(255) DEFAULT NULL,
`recover_hash` varchar(255) DEFAULT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.users: ~0 rows (approximately)
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
-- Dumping structure for table auth.users_permissions
CREATE TABLE IF NOT EXISTS `users_permissions` (
`user_id` int(10) unsigned NOT NULL,
`permission_id` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY `users_permissions_user_foreign_key` (`user_id`),
KEY `users_permissions_permission_foreign_key` (`permission_id`),
CONSTRAINT `users_permissions_permission_foreign_key` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `users_permissions_user_foreign_key` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.users_permissions: ~0 rows (approximately)
/*!40000 ALTER TABLE `users_permissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `users_permissions` ENABLE KEYS */;
-- Dumping structure for table auth.users_roles
CREATE TABLE IF NOT EXISTS `users_roles` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`role_id` int(11) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `users_roles_users_foreign_key` (`user_id`),
KEY `users_roles_roles_foreign_key` (`role_id`),
CONSTRAINT `users_roles_roles_foreign_key` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `users_roles_users_foreign_key` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table auth.users_roles: ~0 rows (approximately)
/*!40000 ALTER TABLE `users_roles` DISABLE KEYS */;
/*!40000 ALTER TABLE `users_roles` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;