forked from cyklokoalicia/OpenSourceBikeShare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-database.sql
166 lines (139 loc) · 4.5 KB
/
create-database.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
-- Adminer 4.1.0 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
DROP TABLE IF EXISTS `bikes`;
CREATE TABLE `bikes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bikeNum` int(11) NOT NULL,
`currentUser` int(11) DEFAULT NULL,
`currentStand` int(11) DEFAULT NULL,
`currentCode` int(11) NOT NULL,
`note` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`bikeNum`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `credit`;
CREATE TABLE `credit` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`credit` float(5,2) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `coupons`;
CREATE TABLE `coupons` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`coupon` varchar(6) NOT NULL,
`value` float(5,2),
`status` int(11) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY (`coupon`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `notes`;
CREATE TABLE `notes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`bikeNum` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`note` varchar(100),
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` timestamp NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `geolocation`;
CREATE TABLE `geolocation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(10) unsigned NOT NULL,
`longitude` double(20,17) NOT NULL,
`latitude` double(20,17) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `history`;
CREATE TABLE `history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`bikeNum` int(11) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`action` varchar(20) NOT NULL,
`parameter` text NOT NULL,
`standId` int(11) DEFAULT NULL,
`pairAction` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `limits`;
CREATE TABLE `limits` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`userLimit` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `pairing`;
CREATE TABLE `pairing` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`standid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `received`;
CREATE TABLE `received` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`sms_uuid` varchar(60) NOT NULL,
`sender` varchar(20) NOT NULL,
`receive_time` varchar(20) NOT NULL,
`sms_text` varchar(200) NOT NULL,
`IP` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `registration`;
CREATE TABLE `registration` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`userKey` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `sent`;
CREATE TABLE `sent` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`number` varchar(20) NOT NULL,
`text` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(10) unsigned NOT NULL,
`sessionId` varchar(256) CHARACTER SET latin1 NOT NULL,
`timeStamp` varchar(256) CHARACTER SET latin1 NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `userId` (`userId`),
KEY `sessionId` (`sessionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `stands`;
CREATE TABLE `stands` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`standName` varchar(50) NOT NULL,
`standDescription` varchar(255),
`standPhoto` varchar(255),
`serviceTag` int(10),
`placeName` varchar(50) NOT NULL,
`longitude` double(20,17),
`latitude` double(20,17),
PRIMARY KEY (`id`),
UNIQUE KEY `standName` (`standName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userName` varchar(50) NOT NULL,
`password` text NOT NULL,
`mail` varchar(30) NOT NULL,
`number` varchar(30) NOT NULL,
`privileges` int(11) NOT NULL DEFAULT '0',
`note` text NOT NULL,
`recommendations` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2014-11-20 11:19:49