-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.sql
245 lines (227 loc) · 10 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
/*
Navicat Premium Data Transfer
Source Server : A11Y New
Source Server Type : MariaDB
Source Server Version : 100221
Source Schema : platform
Target Server Type : MariaDB
Target Server Version : 100221
File Encoding : 65001
Date: 29/08/2019 12:26:46
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER';
-- ----------------------------
-- Table structure for platform-access-tokens
-- ----------------------------
DROP TABLE IF EXISTS `platform-access-tokens`;
CREATE TABLE `platform-access-tokens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`description` text COLLATE utf8mb4_bin DEFAULT NULL,
`jwtAccessToken` text COLLATE utf8mb4_bin NOT NULL,
`scopes` text COLLATE utf8mb4_bin DEFAULT NULL,
`expiresAt` datetime NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-agastya-api-keys
-- ----------------------------
DROP TABLE IF EXISTS `platform-agastya-api-keys`;
CREATE TABLE `platform-agastya-api-keys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organizationId` int(11) NOT NULL,
`name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`slug` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`backgroundColor` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`foregroundColor` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`customCss` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`variables` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`links` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`layout` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`integrations` longtext COLLATE utf8mb4_bin DEFAULT NULL,
`domains` text COLLATE utf8mb4_bin DEFAULT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-api-keys
-- ----------------------------
DROP TABLE IF EXISTS `platform-api-keys`;
CREATE TABLE `platform-api-keys` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`description` text COLLATE utf8mb4_bin DEFAULT NULL,
`jwtApiKey` text COLLATE utf8mb4_bin NOT NULL,
`organizationId` int(12) NOT NULL,
`ipRestrictions` text COLLATE utf8mb4_bin DEFAULT NULL,
`referrerRestrictions` text COLLATE utf8mb4_bin DEFAULT NULL,
`scopes` text COLLATE utf8mb4_bin DEFAULT NULL,
`expiresAt` datetime NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-approved-locations
-- ----------------------------
DROP TABLE IF EXISTS `platform-approved-locations`;
CREATE TABLE `platform-approved-locations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`subnet` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`createdAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-backup-codes
-- ----------------------------
DROP TABLE IF EXISTS `platform-backup-codes`;
CREATE TABLE `platform-backup-codes` (
`code` int(6) NOT NULL,
`userId` int(11) NOT NULL,
`used` int(1) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`code`),
KEY `id` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-domains
-- ----------------------------
DROP TABLE IF EXISTS `platform-domains`;
CREATE TABLE `platform-domains` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organizationId` int(11) NOT NULL,
`domain` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`verificationCode` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`isVerified` int(1) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-emails
-- ----------------------------
DROP TABLE IF EXISTS `platform-emails`;
CREATE TABLE `platform-emails` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`userId` int(11) NOT NULL,
`isVerified` int(1) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `userId` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-memberships
-- ----------------------------
DROP TABLE IF EXISTS `platform-memberships`;
CREATE TABLE `platform-memberships` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organizationId` int(11) NOT NULL,
`userId` int(11) NOT NULL,
`role` varchar(10) COLLATE utf8mb4_bin NOT NULL DEFAULT 'member',
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `org` (`organizationId`),
KEY `user` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-organizations
-- ----------------------------
DROP TABLE IF EXISTS `platform-organizations`;
CREATE TABLE `platform-organizations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`username` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`stripeCustomerId` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`ipRestrictions` text COLLATE utf8mb4_bin DEFAULT NULL,
`forceTwoFactor` int(1) NOT NULL DEFAULT 0,
`autoJoinDomain` int(1) NOT NULL DEFAULT 0,
`onlyAllowDomain` int(1) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`profilePicture` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT 'https://unavatar.now.sh/fallback.png',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-sessions
-- ----------------------------
DROP TABLE IF EXISTS `platform-sessions`;
CREATE TABLE `platform-sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`jwtToken` text COLLATE utf8mb4_bin NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`ipAddress` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`userAgent` text COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-users
-- ----------------------------
DROP TABLE IF EXISTS `platform-users`;
CREATE TABLE `platform-users` (
`id` int(12) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`username` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`nickname` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`primaryEmail` int(12) DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`twoFactorEnabled` int(1) NOT NULL DEFAULT 0,
`twoFactorSecret` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`countryCode` varchar(2) COLLATE utf8mb4_bin DEFAULT 'us',
`timezone` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT 'Europe/Amsterdam',
`notificationEmails` int(1) NOT NULL DEFAULT 1,
`preferredLanguage` varchar(5) COLLATE utf8mb4_bin NOT NULL DEFAULT 'en-us',
`prefersReducedMotion` int(1) NOT NULL DEFAULT 0,
`prefersColorSchemeDark` int(1) NOT NULL DEFAULT 0,
`checkLocationOnLogin` int(1) NOT NULL DEFAULT 0,
`role` int(1) NOT NULL DEFAULT 1,
`gender` varchar(1) COLLATE utf8mb4_bin NOT NULL DEFAULT 'x',
`profilePicture` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-webhooks
-- ----------------------------
DROP TABLE IF EXISTS `platform-webhooks`;
CREATE TABLE `platform-webhooks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`organizationId` int(11) NOT NULL,
`event` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`url` text COLLATE utf8mb4_bin NOT NULL,
`contentType` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`secret` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
`isActive` int(1) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
`lastFiredAt` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for platform-identities
-- ----------------------------
DROP TABLE IF EXISTS `platform-identities`;
CREATE TABLE `platform-identities` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userId` int(11) NOT NULL,
`type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`identityId` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`loginName` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`createdAt` datetime NOT NULL,
`updatedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
SET FOREIGN_KEY_CHECKS = 1;