@authhero/drizzle 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,674 @@
1
+ CREATE TABLE `tenants` (
2
+ `id` text(191) PRIMARY KEY NOT NULL,
3
+ `name` text(255),
4
+ `audience` text(255),
5
+ `sender_email` text(255),
6
+ `sender_name` text(255),
7
+ `language` text(255),
8
+ `logo` text(255),
9
+ `primary_color` text(255),
10
+ `secondary_color` text(255),
11
+ `created_at` text(35) NOT NULL,
12
+ `updated_at` text(35) NOT NULL,
13
+ `support_url` text(255),
14
+ `idle_session_lifetime` integer,
15
+ `session_lifetime` integer,
16
+ `session_cookie` text,
17
+ `allowed_logout_urls` text,
18
+ `ephemeral_session_lifetime` integer,
19
+ `idle_ephemeral_session_lifetime` integer,
20
+ `default_redirection_uri` text,
21
+ `enabled_locales` text,
22
+ `default_directory` text(255),
23
+ `error_page` text,
24
+ `flags` text,
25
+ `friendly_name` text(255),
26
+ `picture_url` text,
27
+ `support_email` text(255),
28
+ `sandbox_version` text(50),
29
+ `sandbox_versions_available` text,
30
+ `legacy_sandbox_version` text(50),
31
+ `change_password` text,
32
+ `guardian_mfa_page` text,
33
+ `device_flow` text,
34
+ `default_token_quota` text,
35
+ `default_audience` text(255),
36
+ `default_organization` text(255),
37
+ `sessions` text,
38
+ `oidc_logout` text,
39
+ `allow_organization_name_in_authentication_api` integer,
40
+ `customize_mfa_in_postlogin_action` integer,
41
+ `acr_values_supported` text,
42
+ `mtls` text,
43
+ `pushed_authorization_requests_supported` integer,
44
+ `authorization_response_iss_parameter_supported` integer
45
+ );
46
+ --> statement-breakpoint
47
+ CREATE TABLE `passwords` (
48
+ `id` text(21) PRIMARY KEY NOT NULL,
49
+ `tenant_id` text(191) NOT NULL,
50
+ `user_id` text(255) NOT NULL,
51
+ `created_at` text(35) NOT NULL,
52
+ `updated_at` text(35) NOT NULL,
53
+ `password` text(255) NOT NULL,
54
+ `algorithm` text(16) DEFAULT 'bcrypt' NOT NULL,
55
+ `is_current` integer DEFAULT 1 NOT NULL,
56
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
57
+ );
58
+ --> statement-breakpoint
59
+ CREATE TABLE `users` (
60
+ `user_id` text(255) NOT NULL,
61
+ `tenant_id` text(191) NOT NULL,
62
+ `email` text(255),
63
+ `given_name` text(255),
64
+ `family_name` text(255),
65
+ `nickname` text(255),
66
+ `name` text(255),
67
+ `picture` text(2083),
68
+ `tags` text(255),
69
+ `phone_number` text(17),
70
+ `phone_verified` integer,
71
+ `username` text(128),
72
+ `created_at` text(35) NOT NULL,
73
+ `updated_at` text(35) NOT NULL,
74
+ `linked_to` text(255),
75
+ `last_ip` text(255),
76
+ `login_count` integer NOT NULL,
77
+ `last_login` text(255),
78
+ `provider` text(255) NOT NULL,
79
+ `connection` text(255),
80
+ `email_verified` integer NOT NULL,
81
+ `is_social` integer NOT NULL,
82
+ `app_metadata` text(4096) DEFAULT '{}' NOT NULL,
83
+ `user_metadata` text(4096) DEFAULT '{}' NOT NULL,
84
+ `profileData` text(2048),
85
+ `locale` text(255),
86
+ PRIMARY KEY(`user_id`, `tenant_id`),
87
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
88
+ );
89
+ --> statement-breakpoint
90
+ CREATE UNIQUE INDEX `unique_email_provider` ON `users` (`email`,`provider`,`tenant_id`);--> statement-breakpoint
91
+ CREATE UNIQUE INDEX `unique_phone_provider` ON `users` (`phone_number`,`provider`,`tenant_id`);--> statement-breakpoint
92
+ CREATE INDEX `users_email_index` ON `users` (`email`);--> statement-breakpoint
93
+ CREATE INDEX `users_linked_to_index` ON `users` (`linked_to`);--> statement-breakpoint
94
+ CREATE INDEX `users_name_index` ON `users` (`name`);--> statement-breakpoint
95
+ CREATE INDEX `users_phone_tenant_provider_index` ON `users` (`tenant_id`,`phone_number`,`provider`);--> statement-breakpoint
96
+ CREATE TABLE `authentication_codes` (
97
+ `tenant_id` text(191) NOT NULL,
98
+ `code` text(255) PRIMARY KEY NOT NULL,
99
+ `client_id` text(255) NOT NULL,
100
+ `user_id` text(255) NOT NULL,
101
+ `nonce` text(255),
102
+ `state` text(8192),
103
+ `scope` text(1024),
104
+ `response_type` text(256),
105
+ `response_mode` text(256),
106
+ `redirect_uri` text(1024),
107
+ `created_at` text(35) NOT NULL,
108
+ `expires_at` text(35) NOT NULL,
109
+ `used_at` text(35),
110
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
111
+ );
112
+ --> statement-breakpoint
113
+ CREATE TABLE `codes` (
114
+ `code_id` text(191) NOT NULL,
115
+ `tenant_id` text(191) NOT NULL,
116
+ `user_id` text(255),
117
+ `login_id` text(255),
118
+ `connection_id` text(255),
119
+ `code_type` text(255) NOT NULL,
120
+ `created_at` text(35) NOT NULL,
121
+ `expires_at` text(35) NOT NULL,
122
+ `used_at` text(35),
123
+ `code_verifier` text(128),
124
+ `code_challenge` text(128),
125
+ `code_challenge_method` text(5),
126
+ `redirect_uri` text(1024),
127
+ `nonce` text(1024),
128
+ `state` text(2048),
129
+ PRIMARY KEY(`code_id`, `code_type`),
130
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
131
+ );
132
+ --> statement-breakpoint
133
+ CREATE INDEX `codes_expires_at_index` ON `codes` (`expires_at`);--> statement-breakpoint
134
+ CREATE TABLE `login_sessions` (
135
+ `id` text(21) NOT NULL,
136
+ `tenant_id` text(191) NOT NULL,
137
+ `session_id` text(21),
138
+ `csrf_token` text(21) NOT NULL,
139
+ `authParams_client_id` text(191) NOT NULL,
140
+ `authParams_vendor_id` text(255),
141
+ `authParams_username` text(255),
142
+ `authParams_response_type` text(255),
143
+ `authParams_response_mode` text(255),
144
+ `authParams_audience` text(255),
145
+ `authParams_scope` text,
146
+ `authParams_state` text,
147
+ `authParams_nonce` text(255),
148
+ `authParams_code_challenge_method` text(255),
149
+ `authParams_code_challenge` text(255),
150
+ `authParams_redirect_uri` text,
151
+ `authParams_organization` text(255),
152
+ `authParams_prompt` text(32),
153
+ `authParams_act_as` text(256),
154
+ `authParams_ui_locales` text(32),
155
+ `authorization_url` text,
156
+ `created_at` text(35) NOT NULL,
157
+ `updated_at` text(35) NOT NULL,
158
+ `expires_at` text(35) NOT NULL,
159
+ `ip` text(39),
160
+ `useragent` text,
161
+ `auth0Client` text(255),
162
+ `login_completed` integer DEFAULT 0,
163
+ PRIMARY KEY(`tenant_id`, `id`),
164
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
165
+ );
166
+ --> statement-breakpoint
167
+ CREATE INDEX `login_sessions_id_index` ON `login_sessions` (`id`);--> statement-breakpoint
168
+ CREATE TABLE `otps` (
169
+ `tenant_id` text(191) NOT NULL,
170
+ `id` text(255) PRIMARY KEY NOT NULL,
171
+ `client_id` text(255) NOT NULL,
172
+ `code` text(255) NOT NULL,
173
+ `email` text(255) NOT NULL,
174
+ `user_id` text(255),
175
+ `send` text(255),
176
+ `nonce` text(255),
177
+ `state` text(1024),
178
+ `scope` text(1024),
179
+ `response_type` text(256),
180
+ `response_mode` text(256),
181
+ `redirect_uri` text(1024),
182
+ `created_at` text(35) NOT NULL,
183
+ `expires_at` text(35) NOT NULL,
184
+ `used_at` text(35),
185
+ `audience` text(255),
186
+ `ip` text(64),
187
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
188
+ );
189
+ --> statement-breakpoint
190
+ CREATE INDEX `otps_email_index` ON `otps` (`email`);--> statement-breakpoint
191
+ CREATE INDEX `otps_expires_at_index` ON `otps` (`expires_at`);--> statement-breakpoint
192
+ CREATE TABLE `refresh_tokens` (
193
+ `id` text(21) NOT NULL,
194
+ `tenant_id` text(191) NOT NULL,
195
+ `client_id` text(191) NOT NULL,
196
+ `session_id` text(21) NOT NULL,
197
+ `user_id` text(255),
198
+ `resource_servers` text NOT NULL,
199
+ `device` text NOT NULL,
200
+ `rotating` integer NOT NULL,
201
+ `created_at` text(35) NOT NULL,
202
+ `expires_at` text(35),
203
+ `idle_expires_at` text(35),
204
+ `last_exchanged_at` text(35),
205
+ PRIMARY KEY(`tenant_id`, `id`),
206
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
207
+ );
208
+ --> statement-breakpoint
209
+ CREATE TABLE `sessions` (
210
+ `id` text(21) NOT NULL,
211
+ `tenant_id` text(191) NOT NULL,
212
+ `user_id` text(255),
213
+ `created_at` text(35) NOT NULL,
214
+ `updated_at` text(35) NOT NULL,
215
+ `expires_at` text(35),
216
+ `idle_expires_at` text(35),
217
+ `authenticated_at` text(35),
218
+ `last_interaction_at` text(35),
219
+ `used_at` text(35),
220
+ `revoked_at` text(35),
221
+ `device` text NOT NULL,
222
+ `clients` text NOT NULL,
223
+ `login_session_id` text(21),
224
+ PRIMARY KEY(`tenant_id`, `id`),
225
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
226
+ );
227
+ --> statement-breakpoint
228
+ CREATE INDEX `IDX_sessions_login_session_id` ON `sessions` (`login_session_id`);--> statement-breakpoint
229
+ CREATE TABLE `tickets` (
230
+ `tenant_id` text(191) NOT NULL,
231
+ `id` text(255) PRIMARY KEY NOT NULL,
232
+ `client_id` text(255) NOT NULL,
233
+ `email` text(255) NOT NULL,
234
+ `nonce` text(255),
235
+ `state` text(1024),
236
+ `scope` text(1024),
237
+ `response_type` text(256),
238
+ `response_mode` text(256),
239
+ `redirect_uri` text(1024),
240
+ `created_at` text(35) NOT NULL,
241
+ `expires_at` text(35) NOT NULL,
242
+ `used_at` text(35),
243
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
244
+ );
245
+ --> statement-breakpoint
246
+ CREATE TABLE `client_grants` (
247
+ `id` text(21) NOT NULL,
248
+ `tenant_id` text(191) NOT NULL,
249
+ `client_id` text(191) NOT NULL,
250
+ `audience` text(191) NOT NULL,
251
+ `scope` text DEFAULT '[]',
252
+ `organization_usage` text(32),
253
+ `allow_any_organization` integer DEFAULT 0,
254
+ `is_system` integer DEFAULT 0,
255
+ `subject_type` text(32),
256
+ `authorization_details_types` text DEFAULT '[]',
257
+ `created_at` text(35) NOT NULL,
258
+ `updated_at` text(35) NOT NULL,
259
+ PRIMARY KEY(`tenant_id`, `id`),
260
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
261
+ );
262
+ --> statement-breakpoint
263
+ CREATE INDEX `idx_client_grants_audience` ON `client_grants` (`audience`);--> statement-breakpoint
264
+ CREATE TABLE `clients` (
265
+ `client_id` text(191) NOT NULL,
266
+ `tenant_id` text(191) NOT NULL,
267
+ `name` text(255) NOT NULL,
268
+ `description` text(140),
269
+ `global` integer DEFAULT 0 NOT NULL,
270
+ `client_secret` text(255),
271
+ `app_type` text(64) DEFAULT 'regular_web',
272
+ `logo_uri` text(2083),
273
+ `is_first_party` integer DEFAULT 0 NOT NULL,
274
+ `oidc_conformant` integer DEFAULT 1 NOT NULL,
275
+ `callbacks` text NOT NULL,
276
+ `allowed_origins` text NOT NULL,
277
+ `web_origins` text NOT NULL,
278
+ `client_aliases` text NOT NULL,
279
+ `allowed_clients` text NOT NULL,
280
+ `allowed_logout_urls` text NOT NULL,
281
+ `session_transfer` text NOT NULL,
282
+ `oidc_logout` text NOT NULL,
283
+ `grant_types` text NOT NULL,
284
+ `jwt_configuration` text NOT NULL,
285
+ `signing_keys` text NOT NULL,
286
+ `encryption_key` text NOT NULL,
287
+ `sso` integer DEFAULT 0 NOT NULL,
288
+ `sso_disabled` integer DEFAULT 1 NOT NULL,
289
+ `cross_origin_authentication` integer DEFAULT 0 NOT NULL,
290
+ `cross_origin_loc` text(2083),
291
+ `custom_login_page_on` integer DEFAULT 0 NOT NULL,
292
+ `custom_login_page` text,
293
+ `custom_login_page_preview` text,
294
+ `form_template` text,
295
+ `addons` text NOT NULL,
296
+ `token_endpoint_auth_method` text(64) DEFAULT 'client_secret_basic',
297
+ `client_metadata` text NOT NULL,
298
+ `mobile` text NOT NULL,
299
+ `initiate_login_uri` text(2083),
300
+ `native_social_login` text NOT NULL,
301
+ `refresh_token` text NOT NULL,
302
+ `default_organization` text NOT NULL,
303
+ `organization_usage` text(32) DEFAULT 'deny',
304
+ `organization_require_behavior` text(32) DEFAULT 'no_prompt',
305
+ `client_authentication_methods` text NOT NULL,
306
+ `require_pushed_authorization_requests` integer DEFAULT 0 NOT NULL,
307
+ `require_proof_of_possession` integer DEFAULT 0 NOT NULL,
308
+ `signed_request_object` text NOT NULL,
309
+ `compliance_level` text(64),
310
+ `par_request_expiry` integer,
311
+ `token_quota` text NOT NULL,
312
+ `created_at` text(35) NOT NULL,
313
+ `updated_at` text(35) NOT NULL,
314
+ `connections` text DEFAULT '[]' NOT NULL,
315
+ PRIMARY KEY(`tenant_id`, `client_id`),
316
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
317
+ );
318
+ --> statement-breakpoint
319
+ CREATE TABLE `connections` (
320
+ `id` text(255) PRIMARY KEY NOT NULL,
321
+ `tenant_id` text(191) NOT NULL,
322
+ `name` text(255) NOT NULL,
323
+ `response_type` text(255),
324
+ `response_mode` text(255),
325
+ `strategy` text(64),
326
+ `options` text(2048) DEFAULT '{}' NOT NULL,
327
+ `created_at` text(35) NOT NULL,
328
+ `updated_at` text(35) NOT NULL,
329
+ `display_name` text(255),
330
+ `is_domain_connection` integer,
331
+ `show_as_button` integer,
332
+ `is_system` integer DEFAULT 0 NOT NULL,
333
+ `metadata` text(4096),
334
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
335
+ );
336
+ --> statement-breakpoint
337
+ CREATE INDEX `connections_tenant_id_index` ON `connections` (`tenant_id`);--> statement-breakpoint
338
+ CREATE TABLE `custom_domains` (
339
+ `custom_domain_id` text(256) PRIMARY KEY NOT NULL,
340
+ `tenant_id` text(191) NOT NULL,
341
+ `domain` text(255) NOT NULL,
342
+ `primary` integer NOT NULL,
343
+ `status` text(50) NOT NULL,
344
+ `type` text(50) NOT NULL,
345
+ `origin_domain_name` text(255),
346
+ `verification` text(2048),
347
+ `custom_client_ip_header` text(50),
348
+ `tls_policy` text(50),
349
+ `domain_metadata` text(2048),
350
+ `created_at` text(35) NOT NULL,
351
+ `updated_at` text(35) NOT NULL,
352
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
353
+ );
354
+ --> statement-breakpoint
355
+ CREATE TABLE `domains` (
356
+ `id` text(255) PRIMARY KEY NOT NULL,
357
+ `tenant_id` text(191) NOT NULL,
358
+ `domain` text(255) NOT NULL,
359
+ `email_service` text(255),
360
+ `email_api_key` text(255),
361
+ `dkim_private_key` text(2048),
362
+ `dkim_public_key` text(2048),
363
+ `created_at` text(35) NOT NULL,
364
+ `updated_at` text(35) NOT NULL,
365
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
366
+ );
367
+ --> statement-breakpoint
368
+ CREATE TABLE `invites` (
369
+ `id` text(21) PRIMARY KEY NOT NULL,
370
+ `tenant_id` text(191) NOT NULL,
371
+ `organization_id` text(21) NOT NULL,
372
+ `inviter` text NOT NULL,
373
+ `invitee` text NOT NULL,
374
+ `client_id` text(191) NOT NULL,
375
+ `connection_id` text(21),
376
+ `invitation_url` text NOT NULL,
377
+ `created_at` text(35) NOT NULL,
378
+ `expires_at` text(35) NOT NULL,
379
+ `app_metadata` text,
380
+ `user_metadata` text,
381
+ `roles` text,
382
+ `ticket_id` text(191),
383
+ `ttl_sec` integer,
384
+ `send_invitation_email` integer
385
+ );
386
+ --> statement-breakpoint
387
+ CREATE INDEX `idx_invites_tenant_id` ON `invites` (`tenant_id`);--> statement-breakpoint
388
+ CREATE INDEX `idx_invites_organization_id` ON `invites` (`organization_id`);--> statement-breakpoint
389
+ CREATE INDEX `idx_invites_expires_at` ON `invites` (`expires_at`);--> statement-breakpoint
390
+ CREATE INDEX `idx_invites_tenant_created` ON `invites` (`tenant_id`,`created_at`);--> statement-breakpoint
391
+ CREATE TABLE `organizations` (
392
+ `id` text(21) PRIMARY KEY NOT NULL,
393
+ `tenant_id` text(191) NOT NULL,
394
+ `name` text(256) NOT NULL,
395
+ `display_name` text(256),
396
+ `branding` text,
397
+ `metadata` text,
398
+ `enabled_connections` text,
399
+ `token_quota` text,
400
+ `created_at` text(35) NOT NULL,
401
+ `updated_at` text(35) NOT NULL
402
+ );
403
+ --> statement-breakpoint
404
+ CREATE INDEX `idx_organizations_tenant_id` ON `organizations` (`tenant_id`);--> statement-breakpoint
405
+ CREATE TABLE `user_organizations` (
406
+ `id` text(21) PRIMARY KEY NOT NULL,
407
+ `tenant_id` text(191) NOT NULL,
408
+ `user_id` text(191) NOT NULL,
409
+ `organization_id` text(21) NOT NULL,
410
+ `created_at` text(35) NOT NULL,
411
+ `updated_at` text(35) NOT NULL
412
+ );
413
+ --> statement-breakpoint
414
+ CREATE UNIQUE INDEX `user_organizations_unique` ON `user_organizations` (`tenant_id`,`user_id`,`organization_id`);--> statement-breakpoint
415
+ CREATE INDEX `idx_user_organizations_tenant_id` ON `user_organizations` (`tenant_id`);--> statement-breakpoint
416
+ CREATE INDEX `idx_user_organizations_user_id` ON `user_organizations` (`user_id`);--> statement-breakpoint
417
+ CREATE INDEX `idx_user_organizations_organization_id` ON `user_organizations` (`organization_id`);--> statement-breakpoint
418
+ CREATE TABLE `resource_servers` (
419
+ `id` text(21) NOT NULL,
420
+ `tenant_id` text(191) NOT NULL,
421
+ `identifier` text(191) NOT NULL,
422
+ `name` text(255) NOT NULL,
423
+ `scopes` text(4096),
424
+ `signing_alg` text(64),
425
+ `signing_secret` text(2048),
426
+ `token_lifetime` integer,
427
+ `token_lifetime_for_web` integer,
428
+ `skip_consent_for_verifiable_first_party_clients` integer,
429
+ `allow_offline_access` integer,
430
+ `verification_key` text(4096),
431
+ `options` text(4096),
432
+ `is_system` integer DEFAULT 0 NOT NULL,
433
+ `created_at` text(35) NOT NULL,
434
+ `updated_at` text(35) NOT NULL,
435
+ PRIMARY KEY(`tenant_id`, `id`)
436
+ );
437
+ --> statement-breakpoint
438
+ CREATE TABLE `role_permissions` (
439
+ `tenant_id` text(191) NOT NULL,
440
+ `role_id` text(21) NOT NULL,
441
+ `resource_server_identifier` text(191) NOT NULL,
442
+ `permission_name` text(191) NOT NULL,
443
+ `created_at` text(35) NOT NULL,
444
+ PRIMARY KEY(`tenant_id`, `role_id`, `resource_server_identifier`, `permission_name`)
445
+ );
446
+ --> statement-breakpoint
447
+ CREATE INDEX `role_permissions_role_fk` ON `role_permissions` (`tenant_id`,`role_id`);--> statement-breakpoint
448
+ CREATE INDEX `role_permissions_permission_fk` ON `role_permissions` (`tenant_id`,`resource_server_identifier`,`permission_name`);--> statement-breakpoint
449
+ CREATE TABLE `roles` (
450
+ `id` text(21) NOT NULL,
451
+ `tenant_id` text(191) NOT NULL,
452
+ `name` text(50) NOT NULL,
453
+ `description` text(255),
454
+ `is_system` integer DEFAULT 0 NOT NULL,
455
+ `created_at` text(35) NOT NULL,
456
+ `updated_at` text(35) NOT NULL,
457
+ PRIMARY KEY(`tenant_id`, `id`)
458
+ );
459
+ --> statement-breakpoint
460
+ CREATE TABLE `user_permissions` (
461
+ `tenant_id` text(191) NOT NULL,
462
+ `user_id` text(191) NOT NULL,
463
+ `resource_server_identifier` text(191) NOT NULL,
464
+ `permission_name` text(191) NOT NULL,
465
+ `organization_id` text(21) DEFAULT '' NOT NULL,
466
+ `created_at` text(35) NOT NULL,
467
+ PRIMARY KEY(`tenant_id`, `user_id`, `resource_server_identifier`, `permission_name`, `organization_id`)
468
+ );
469
+ --> statement-breakpoint
470
+ CREATE INDEX `user_permissions_user_fk` ON `user_permissions` (`tenant_id`,`user_id`);--> statement-breakpoint
471
+ CREATE INDEX `user_permissions_permission_fk` ON `user_permissions` (`tenant_id`,`resource_server_identifier`,`permission_name`);--> statement-breakpoint
472
+ CREATE INDEX `user_permissions_organization_fk` ON `user_permissions` (`organization_id`);--> statement-breakpoint
473
+ CREATE TABLE `user_roles` (
474
+ `tenant_id` text(191) NOT NULL,
475
+ `user_id` text(191) NOT NULL,
476
+ `role_id` text(21) NOT NULL,
477
+ `organization_id` text(191) DEFAULT '' NOT NULL,
478
+ `created_at` text(35) NOT NULL,
479
+ PRIMARY KEY(`tenant_id`, `user_id`, `role_id`, `organization_id`)
480
+ );
481
+ --> statement-breakpoint
482
+ CREATE INDEX `user_roles_user_fk` ON `user_roles` (`tenant_id`,`user_id`);--> statement-breakpoint
483
+ CREATE INDEX `user_roles_role_fk` ON `user_roles` (`tenant_id`,`role_id`);--> statement-breakpoint
484
+ CREATE INDEX `user_roles_organization_fk` ON `user_roles` (`organization_id`);--> statement-breakpoint
485
+ CREATE TABLE `branding` (
486
+ `tenant_id` text(191) PRIMARY KEY NOT NULL,
487
+ `logo_url` text(512),
488
+ `favicon_url` text(512),
489
+ `font_url` text(512),
490
+ `colors_primary` text(8),
491
+ `colors_page_background_type` text(32),
492
+ `colors_page_background_start` text(8),
493
+ `colors_page_background_end` text(8),
494
+ `colors_page_background_angle_dev` integer,
495
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
496
+ );
497
+ --> statement-breakpoint
498
+ CREATE TABLE `email_providers` (
499
+ `tenant_id` text(191) PRIMARY KEY NOT NULL,
500
+ `name` text(255) NOT NULL,
501
+ `enabled` integer NOT NULL,
502
+ `default_from_address` text(255),
503
+ `credentials` text(2048) DEFAULT '{}' NOT NULL,
504
+ `settings` text(2048) DEFAULT '{}' NOT NULL,
505
+ `created_at` text(35) NOT NULL,
506
+ `updated_at` text(35) NOT NULL
507
+ );
508
+ --> statement-breakpoint
509
+ CREATE TABLE `flows` (
510
+ `id` text(24) PRIMARY KEY NOT NULL,
511
+ `tenant_id` text(191) NOT NULL,
512
+ `name` text(150) NOT NULL,
513
+ `actions` text,
514
+ `created_at` text(35) NOT NULL,
515
+ `updated_at` text(35) NOT NULL,
516
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
517
+ );
518
+ --> statement-breakpoint
519
+ CREATE INDEX `flows_tenant_id_idx` ON `flows` (`tenant_id`);--> statement-breakpoint
520
+ CREATE TABLE `forms` (
521
+ `id` text(255) PRIMARY KEY NOT NULL,
522
+ `name` text(255) NOT NULL,
523
+ `tenant_id` text(191) NOT NULL,
524
+ `messages` text(255),
525
+ `languages` text(255),
526
+ `translations` text(4096),
527
+ `nodes` text(4096),
528
+ `start` text(255),
529
+ `ending` text(255),
530
+ `style` text(1042),
531
+ `created_at` text(35) NOT NULL,
532
+ `updated_at` text(35) NOT NULL,
533
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
534
+ );
535
+ --> statement-breakpoint
536
+ CREATE INDEX `forms_tenant_id_idx` ON `forms` (`tenant_id`);--> statement-breakpoint
537
+ CREATE TABLE `hooks` (
538
+ `hook_id` text(255) PRIMARY KEY NOT NULL,
539
+ `tenant_id` text(191) NOT NULL,
540
+ `url` text(512) NOT NULL,
541
+ `trigger_id` text(255) NOT NULL,
542
+ `enabled` integer NOT NULL,
543
+ `created_at` text(35) NOT NULL,
544
+ `updated_at` text(35) NOT NULL,
545
+ `synchronous` integer DEFAULT false NOT NULL,
546
+ `priority` integer,
547
+ `form_id` text,
548
+ `url_tmp` text(512),
549
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
550
+ );
551
+ --> statement-breakpoint
552
+ CREATE TABLE `keys` (
553
+ `kid` text(255) PRIMARY KEY NOT NULL,
554
+ `tenant_id` text(191),
555
+ `created_at` text(35) NOT NULL,
556
+ `revoked_at` text(35),
557
+ `cert` text(4096),
558
+ `pkcs7` text(4096),
559
+ `fingerprint` text(256),
560
+ `thumbprint` text(256),
561
+ `current_since` text(35),
562
+ `current_until` text(35),
563
+ `type` text(50) DEFAULT 'jwt_signing' NOT NULL,
564
+ `connection` text(255),
565
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade,
566
+ FOREIGN KEY (`connection`) REFERENCES `connections`(`id`) ON UPDATE no action ON DELETE cascade
567
+ );
568
+ --> statement-breakpoint
569
+ CREATE TABLE `prompt_settings` (
570
+ `tenant_id` text(191) PRIMARY KEY NOT NULL,
571
+ `universal_login_experience` text(16) DEFAULT 'new' NOT NULL,
572
+ `identifier_first` integer DEFAULT true NOT NULL,
573
+ `password_first` integer DEFAULT false NOT NULL,
574
+ `webauthn_platform_first_factor` integer DEFAULT false NOT NULL
575
+ );
576
+ --> statement-breakpoint
577
+ CREATE TABLE `themes` (
578
+ `tenant_id` text(191) NOT NULL,
579
+ `themeId` text(255) NOT NULL,
580
+ `displayName` text(255) NOT NULL,
581
+ `colors_primary_button_label` text(24) NOT NULL,
582
+ `colors_primary_button` text(24) NOT NULL,
583
+ `colors_secondary_button_border` text(24) NOT NULL,
584
+ `colors_secondary_button_label` text(24) NOT NULL,
585
+ `colors_base_focus_color` text(24) NOT NULL,
586
+ `colors_base_hover_color` text(24) NOT NULL,
587
+ `colors_body_text` text(24) NOT NULL,
588
+ `colors_captcha_widget_theme` text(24) NOT NULL,
589
+ `colors_error` text(24) NOT NULL,
590
+ `colors_header` text(24) NOT NULL,
591
+ `colors_icons` text(24) NOT NULL,
592
+ `colors_input_background` text(24) NOT NULL,
593
+ `colors_input_border` text(24) NOT NULL,
594
+ `colors_input_filled_text` text(24) NOT NULL,
595
+ `colors_input_labels_placeholders` text(24) NOT NULL,
596
+ `colors_links_focused_components` text(24) NOT NULL,
597
+ `colors_success` text(24) NOT NULL,
598
+ `colors_widget_background` text(24) NOT NULL,
599
+ `colors_widget_border` text(24) NOT NULL,
600
+ `borders_button_border_radius` integer NOT NULL,
601
+ `borders_button_border_weight` integer NOT NULL,
602
+ `borders_buttons_style` text(24) NOT NULL,
603
+ `borders_input_border_radius` integer NOT NULL,
604
+ `borders_input_border_weight` integer NOT NULL,
605
+ `borders_inputs_style` text(24) NOT NULL,
606
+ `borders_show_widget_shadow` integer NOT NULL,
607
+ `borders_widget_border_weight` integer NOT NULL,
608
+ `borders_widget_corner_radius` integer NOT NULL,
609
+ `fonts_body_text_bold` integer NOT NULL,
610
+ `fonts_body_text_size` integer NOT NULL,
611
+ `fonts_buttons_text_bold` integer NOT NULL,
612
+ `fonts_buttons_text_size` integer NOT NULL,
613
+ `fonts_font_url` text(255) NOT NULL,
614
+ `fonts_input_labels_bold` integer NOT NULL,
615
+ `fonts_input_labels_size` integer NOT NULL,
616
+ `fonts_links_bold` integer NOT NULL,
617
+ `fonts_links_size` integer NOT NULL,
618
+ `fonts_links_style` text(24) NOT NULL,
619
+ `fonts_reference_text_size` integer NOT NULL,
620
+ `fonts_subtitle_bold` integer NOT NULL,
621
+ `fonts_subtitle_size` integer NOT NULL,
622
+ `fonts_title_bold` integer NOT NULL,
623
+ `fonts_title_size` integer NOT NULL,
624
+ `page_background_background_color` text(24) NOT NULL,
625
+ `page_background_background_image_url` text(255) NOT NULL,
626
+ `page_background_page_layout` text(24) NOT NULL,
627
+ `widget_header_text_alignment` text(24) NOT NULL,
628
+ `widget_logo_height` integer NOT NULL,
629
+ `widget_logo_position` text(24) NOT NULL,
630
+ `widget_logo_url` text(255) NOT NULL,
631
+ `widget_social_buttons_layout` text(24) NOT NULL,
632
+ `created_at` text(35) NOT NULL,
633
+ `updated_at` text(35) NOT NULL,
634
+ PRIMARY KEY(`tenant_id`, `themeId`),
635
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
636
+ );
637
+ --> statement-breakpoint
638
+ CREATE INDEX `themes_tenant_id_idx` ON `themes` (`tenant_id`);--> statement-breakpoint
639
+ CREATE TABLE `logs` (
640
+ `log_id` text(21) PRIMARY KEY NOT NULL,
641
+ `category` text(255),
642
+ `tenant_id` text(64),
643
+ `user_id` text(64),
644
+ `ip` text(255),
645
+ `type` text(8) NOT NULL,
646
+ `date` text(35) NOT NULL,
647
+ `client_id` text(255),
648
+ `client_name` text(255),
649
+ `user_agent` text(255),
650
+ `description` text(255),
651
+ `details` text(2048),
652
+ `isMobile` integer,
653
+ `user_name` text(255),
654
+ `connection` text(255),
655
+ `connection_id` text(255),
656
+ `audience` text(255),
657
+ `scope` text(255),
658
+ `strategy` text(255),
659
+ `strategy_type` text(255),
660
+ `hostname` text(255),
661
+ `auth0_client` text(8192),
662
+ `session_connection` text(255),
663
+ `country_code` text(2),
664
+ `city_name` text(255),
665
+ `latitude` text(255),
666
+ `longitude` text(255),
667
+ `time_zone` text(255),
668
+ `continent_code` text(2)
669
+ );
670
+ --> statement-breakpoint
671
+ CREATE INDEX `logs_user_id` ON `logs` (`user_id`);--> statement-breakpoint
672
+ CREATE INDEX `logs_tenant_id` ON `logs` (`tenant_id`);--> statement-breakpoint
673
+ CREATE INDEX `logs_date` ON `logs` (`date`);--> statement-breakpoint
674
+ CREATE INDEX `IDX_logs_tenant_date_type_user` ON `logs` (`tenant_id`,`date`,`type`,`user_id`);