-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-database.sql
143 lines (115 loc) · 3.81 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
-- Adminer 4.1.0 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
DROP TABLE IF EXISTS `bikes`;
CREATE TABLE `bikes` (
`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 (`bikeNum`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `credit`;
CREATE TABLE `credit` (
`userId` int(11) NOT NULL,
`credit` float(5,2) DEFAULT NULL,
PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `coupons`;
CREATE TABLE `coupons` (
`coupon` varchar(6) NOT NULL,
`value` float(5,2),
`status` int(11) DEFAULT '0',
UNIQUE KEY `coupon` (`coupon`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `notes`;
CREATE TABLE `notes` (
`bikeNum` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`note` varchar(100),
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`deleted` timestamp NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `geolocation`;
CREATE TABLE `geolocation` (
`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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `history`;
CREATE TABLE `history` (
`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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `limits`;
CREATE TABLE `limits` (
`userId` int(11) NOT NULL AUTO_INCREMENT,
`userLimit` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `pairing`;
CREATE TABLE `pairing` (
`time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`standid` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `received`;
CREATE TABLE `received` (
`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
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `registration`;
CREATE TABLE `registration` (
`userId` int(11) NOT NULL,
`userKey` varchar(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `sent`;
CREATE TABLE `sent` (
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`number` varchar(20) NOT NULL,
`text` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `sessions`;
CREATE TABLE `sessions` (
`userId` int(10) unsigned NOT NULL,
`sessionId` varchar(256) CHARACTER SET latin1 NOT NULL,
`timeStamp` varchar(256) CHARACTER SET latin1 NOT NULL,
UNIQUE KEY `userId` (`userId`),
KEY `sessionId` (`sessionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `stands`;
CREATE TABLE `stands` (
`standId` 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 (`standId`),
UNIQUE KEY `standName` (`standName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`userId` 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 (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- 2014-11-20 11:19:49