-
Notifications
You must be signed in to change notification settings - Fork 19
/
yii2simple.sql
173 lines (143 loc) · 4.71 KB
/
yii2simple.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
--
-- Table structure for table `menu`
--
CREATE TABLE IF NOT EXISTS `menu` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`parent` int(11) DEFAULT NULL,
`route` varchar(256) DEFAULT NULL,
`order` int(11) DEFAULT NULL,
`data` text,
PRIMARY KEY (`id`),
KEY `parent` (`parent`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `migration`
--
CREATE TABLE IF NOT EXISTS `migration` (
`version` varchar(180) NOT NULL,
`apply_time` int(11) DEFAULT NULL,
PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `migration`
--
INSERT INTO `migration` (`version`, `apply_time`) VALUES
('m000000_000000_base', 1416537492),
('m140209_132017_init', 1416537497),
('m140403_174025_create_account_table', 1416537499),
('m140504_113157_update_tables', 1416537508),
('m140504_130429_create_token_table', 1416537510),
('m140602_111327_create_menu_table', 1416537510),
('m140830_171933_fix_ip_field', 1416537512),
('m140830_172703_change_account_table_name', 1416537512),
('m141018_105939_create_table_upload', 1416537512),
('m141018_105939_session_table', 1416537513);
-- --------------------------------------------------------
--
-- Table structure for table `profile`
--
CREATE TABLE IF NOT EXISTS `profile` (
`user_id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`public_email` varchar(255) DEFAULT NULL,
`gravatar_email` varchar(255) DEFAULT NULL,
`gravatar_id` varchar(32) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`bio` text,
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `session`
--
CREATE TABLE IF NOT EXISTS `session` (
`id` varchar(40) NOT NULL,
`expire` int(11) DEFAULT NULL,
`data` blob,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `social_account`
--
CREATE TABLE IF NOT EXISTS `social_account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`provider` varchar(255) NOT NULL,
`client_id` varchar(255) NOT NULL,
`data` text,
PRIMARY KEY (`id`),
UNIQUE KEY `account_unique` (`provider`,`client_id`),
KEY `fk_user_account` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `token`
--
CREATE TABLE IF NOT EXISTS `token` (
`user_id` int(11) NOT NULL,
`code` varchar(32) NOT NULL,
`created_at` int(11) NOT NULL,
`type` smallint(6) NOT NULL,
UNIQUE KEY `token_unique` (`user_id`,`code`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `uploaded_file`
--
CREATE TABLE IF NOT EXISTS `uploaded_file` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
`filename` varchar(256) DEFAULT NULL,
`size` int(11) DEFAULT NULL,
`type` varchar(32) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(25) NOT NULL,
`email` varchar(255) NOT NULL,
`password_hash` varchar(60) NOT NULL,
`auth_key` varchar(32) NOT NULL,
`confirmed_at` int(11) DEFAULT NULL,
`unconfirmed_email` varchar(255) DEFAULT NULL,
`blocked_at` int(11) DEFAULT NULL,
`role` varchar(255) DEFAULT NULL,
`registration_ip` bigint(20) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`flags` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `user_unique_username` (`username`),
UNIQUE KEY `user_unique_email` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `menu`
--
ALTER TABLE `menu`
ADD CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`parent`) REFERENCES `menu` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
--
-- Constraints for table `profile`
--
ALTER TABLE `profile`
ADD CONSTRAINT `fk_user_profile` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `social_account`
--
ALTER TABLE `social_account`
ADD CONSTRAINT `fk_user_account` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `token`
--
ALTER TABLE `token`
ADD CONSTRAINT `fk_user_token` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE;