-
Notifications
You must be signed in to change notification settings - Fork 0
/
database-schema.sql
209 lines (182 loc) · 7.52 KB
/
database-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
CREATE DATABASE IF NOT EXISTS `healthcheck` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `healthcheck`;
-- MySQL dump 10.13 Distrib 8.0.21, for Linux (x86_64)
--
-- Host: localhost Database: healthcheck
-- ------------------------------------------------------
-- Server version 5.7.18-0ubuntu0.16.04.1
/*!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 */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `members`
--
DROP TABLE IF EXISTS `members`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `members` (
`memberid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`fullname` varchar(255) NOT NULL,
`firstname` varchar(255) DEFAULT NULL,
`lastname` varchar(255) NOT NULL,
`lang` char(2) NOT NULL DEFAULT 'en',
`email` varchar(255) DEFAULT NULL,
`smsphone` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`password` text,
`registrationToken` char(32) DEFAULT NULL,
`registrationSmsCode` char(6) DEFAULT NULL,
`passwordResetToken` char(32) DEFAULT NULL,
`passwordResetTokenExpiry` datetime DEFAULT NULL,
`mustChangePassword` tinyint(1) unsigned NOT NULL DEFAULT '0',
`status` enum('active','inactive','disfellowshipped','marked') NOT NULL DEFAULT 'active',
`createdAt` datetime NOT NULL,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`memberid`),
UNIQUE KEY `email_UNIQUE` (`email`),
UNIQUE KEY `smsphone_UNIQUE` (`smsphone`),
KEY `registrationToken_UNIQUE` (`registrationToken`),
KEY `registrationSmsCode_UNIQUE` (`registrationSmsCode`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `members`
--
LOCK TABLES `members` WRITE;
/*!40000 ALTER TABLE `members` DISABLE KEYS */;
INSERT INTO `members` VALUES (1,'Jason McNeill','Jason','McNeill','en','[email protected]','+12133251382',NULL,NULL,'8d2e20fd26596c6564d5f0cafca3a3ee','11e98f',NULL,NULL,0,'active','2020-08-18 21:55:00','2020-08-22 23:31:28');
/*!40000 ALTER TABLE `members` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `members__ministries`
--
DROP TABLE IF EXISTS `members__ministries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `members__ministries` (
`ministryid` int(10) unsigned NOT NULL,
`memberid` int(10) unsigned NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ministryid`,`memberid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `members__ministries`
--
LOCK TABLES `members__ministries` WRITE;
/*!40000 ALTER TABLE `members__ministries` DISABLE KEYS */;
/*!40000 ALTER TABLE `members__ministries` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `members__pending`
--
DROP TABLE IF EXISTS `members__pending`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `members__pending` (
`pendingmemberid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`bibletalkmemberid` int(10) unsigned NOT NULL,
`fullname` varchar(255) NOT NULL,
`firstname` varchar(255) DEFAULT NULL,
`lastname` varchar(255) NOT NULL,
`lang` char(2) NOT NULL DEFAULT 'en',
`email` varchar(255) DEFAULT NULL,
`smsphone` varchar(255) DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`pendingmemberid`),
UNIQUE KEY `email_UNIQUE` (`email`),
UNIQUE KEY `smsphone_UNIQUE` (`smsphone`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `members__pending`
--
LOCK TABLES `members__pending` WRITE;
/*!40000 ALTER TABLE `members__pending` DISABLE KEYS */;
/*!40000 ALTER TABLE `members__pending` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `members__roles`
--
DROP TABLE IF EXISTS `members__roles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `members__roles` (
`memberid` int(10) unsigned NOT NULL,
`role` enum('sysadmin','church leader','super region leader','region leader','sector leader','house church leader','bible talk leader') NOT NULL,
PRIMARY KEY (`memberid`,`role`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `members__roles`
--
LOCK TABLES `members__roles` WRITE;
/*!40000 ALTER TABLE `members__roles` DISABLE KEYS */;
INSERT INTO `members__roles` VALUES (1,'sysadmin');
/*!40000 ALTER TABLE `members__roles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ministries`
--
DROP TABLE IF EXISTS `ministries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `ministries` (
`ministryid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`parentministryid` int(10) unsigned DEFAULT NULL,
`type` enum('church','super region','region','sector','house church','bible talk') NOT NULL,
`name` varchar(255) NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`ministryid`),
KEY `NAME_INDEX` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ministries`
--
LOCK TABLES `ministries` WRITE;
/*!40000 ALTER TABLE `ministries` DISABLE KEYS */;
/*!40000 ALTER TABLE `ministries` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `refreshTokens`
--
DROP TABLE IF EXISTS `refreshTokens`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `refreshTokens` (
`hash` char(64) NOT NULL COMMENT 'SHA256 hash of token, encoded as hex',
`token` text NOT NULL,
`memberid` int(10) unsigned NOT NULL,
`expiry` datetime DEFAULT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`hash`),
KEY `userid` (`memberid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `refreshTokens`
--
LOCK TABLES `refreshTokens` WRITE;
/*!40000 ALTER TABLE `refreshTokens` DISABLE KEYS */;
/*!40000 ALTER TABLE `refreshTokens` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-08-24 9:36:37