-
Notifications
You must be signed in to change notification settings - Fork 1
/
migrate-from-java.sql
118 lines (101 loc) · 3.86 KB
/
migrate-from-java.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
use cloudsession;
rename table user to user_java;
drop TABLE bucket;
drop TABLE confirmtoken;
drop TABLE resettoken;
drop TABLE authenticationtoken;
--
-- Table structure for table `authentication_token`
--
DROP TABLE IF EXISTS `authentication_token`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `authentication_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`id_user` bigint(20) DEFAULT NULL,
`browser` varchar(200) DEFAULT NULL,
`server` varchar(1000) DEFAULT NULL,
`ip_address` varchar(200) DEFAULT NULL,
`validity` datetime DEFAULT NULL,
`token` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `token` (`token`),
KEY `id_user` (`id_user`),
CONSTRAINT `authentication_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `bucket`
--
DROP TABLE IF EXISTS `bucket`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bucket` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`id_user` bigint(20) DEFAULT NULL,
`type` varchar(200) DEFAULT NULL,
`content` int(11) DEFAULT NULL,
`timestamp` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_type_unique` (`id_user`,`type`),
CONSTRAINT `bucket_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `confirm_token`
--
DROP TABLE IF EXISTS `confirm_token`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `confirm_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`id_user` bigint(20) DEFAULT NULL,
`validity` datetime DEFAULT NULL,
`token` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_user` (`id_user`),
UNIQUE KEY `token` (`token`),
CONSTRAINT `confirm_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `reset_token`
--
DROP TABLE IF EXISTS `reset_token`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reset_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`id_user` bigint(20) DEFAULT NULL,
`validity` datetime DEFAULT NULL,
`token` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_user` (`id_user`),
UNIQUE KEY `token` (`token`),
CONSTRAINT `reset_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`email` varchar(250) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`salt` varchar(50) DEFAULT NULL,
`auth_source` varchar(250) DEFAULT NULL,
`locale` varchar(50) DEFAULT NULL,
`blocked` tinyint(1) DEFAULT NULL,
`confirmed` tinyint(1) DEFAULT NULL,
`screen_name` varchar(250) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
insert into user (id, email, password, salt, auth_source, locale, blocked, confirmed, screen_name)
SELECT id, email, password, salt, authsource, locale, blocked, confirmed, screenname from user_java;
drop TABLE user;