-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
261 lines (208 loc) · 7.74 KB
/
schema.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 06, 2015 at 02:28 AM
-- Server version: 5.5.46-0ubuntu0.14.04.2
-- PHP Version: 5.5.9-1ubuntu4.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `meditation_old`
--
-- --------------------------------------------------------
--
-- Table structure for table `anumodana`
--
CREATE TABLE IF NOT EXISTS `anumodana` (
`uid` int(20) NOT NULL,
`sid` bigint(20) NOT NULL,
UNIQUE KEY `constraint` (`uid`,`sid`),
KEY `Session ID` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `anumodana_chat`
--
CREATE TABLE IF NOT EXISTS `anumodana_chat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UQ_CID_UID` (`cid`,`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=678 ;
-- --------------------------------------------------------
--
-- Table structure for table `appointments`
--
CREATE TABLE IF NOT EXISTS `appointments` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`aid` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `aid` (`aid`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=252 ;
-- --------------------------------------------------------
--
-- Table structure for table `appointment_slots`
--
CREATE TABLE IF NOT EXISTS `appointment_slots` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`day` int(1) NOT NULL,
`time` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=49 ;
-- --------------------------------------------------------
--
-- Table structure for table `chats`
--
CREATE TABLE IF NOT EXISTS `chats` (
`cid` bigint(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`time` datetime NOT NULL,
`message` mediumtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`cid`),
KEY `fk_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11746 ;
-- --------------------------------------------------------
--
-- Table structure for table `commitments`
--
CREATE TABLE IF NOT EXISTS `commitments` (
`cid` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`creatorid` int(11) NOT NULL,
`period` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`day` int(3) NOT NULL,
`time` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
`length` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=52 ;
-- --------------------------------------------------------
--
-- Table structure for table `logins`
--
CREATE TABLE IF NOT EXISTS `logins` (
`uid` bigint(11) NOT NULL DEFAULT '0',
`token` varchar(2550) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `misc`
--
CREATE TABLE IF NOT EXISTS `misc` (
`key` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(2550) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `quotes`
--
CREATE TABLE IF NOT EXISTS `quotes` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`quote` varchar(8000) NOT NULL,
`cite` varchar(255) DEFAULT NULL,
`link` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=366 ;
-- --------------------------------------------------------
--
-- Table structure for table `reset`
--
CREATE TABLE IF NOT EXISTS `reset` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`reset_key` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=19 ;
-- --------------------------------------------------------
--
-- Table structure for table `schedule`
--
CREATE TABLE IF NOT EXISTS `schedule` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`time` varchar(4) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(2550) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
-- --------------------------------------------------------
--
-- Table structure for table `sessions`
--
CREATE TABLE IF NOT EXISTS `sessions` (
`sid` bigint(11) NOT NULL AUTO_INCREMENT,
`uid` int(10) NOT NULL,
`start` datetime NOT NULL,
`walking` int(3) NOT NULL,
`sitting` int(3) NOT NULL,
`end` datetime NOT NULL,
`type` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=17927 ;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`password` char(40) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`show_email` int(1) NOT NULL DEFAULT '0',
`website` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`img` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=704 ;
-- --------------------------------------------------------
--
-- Table structure for table `user_commitments`
--
CREATE TABLE IF NOT EXISTS `user_commitments` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`cid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
PRIMARY KEY (`aid`),
UNIQUE KEY `commit` (`cid`,`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=751 ;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `anumodana`
--
ALTER TABLE `anumodana`
ADD CONSTRAINT `sessions` FOREIGN KEY (`sid`) REFERENCES `sessions` (`sid`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `appointments`
--
ALTER TABLE `appointments`
ADD CONSTRAINT `appointments_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `appointments_ibfk_2` FOREIGN KEY (`aid`) REFERENCES `appointment_slots` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `chats`
--
ALTER TABLE `chats`
ADD CONSTRAINT `fk_uid` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`) ON DELETE CASCADE;
--
-- Constraints for table `user_commitments`
--
ALTER TABLE `user_commitments`
ADD CONSTRAINT `FK_commitments` FOREIGN KEY (`cid`) REFERENCES `commitments` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;