@hilbras/keystone 1.9.0 → 2.5.0

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +386 -0
  2. package/README.md +150 -32
  3. package/dist/config.d.ts +8 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +8 -0
  6. package/dist/config.js.map +1 -1
  7. package/dist/db/migrations/0015_chief_vargas.sql +7 -0
  8. package/dist/db/migrations/0016_gorgeous_charles_xavier.sql +5 -0
  9. package/dist/db/migrations/0017_flashy_nekra.sql +1 -0
  10. package/dist/db/migrations/meta/0015_snapshot.json +4340 -0
  11. package/dist/db/migrations/meta/0016_snapshot.json +4363 -0
  12. package/dist/db/migrations/meta/0017_snapshot.json +4370 -0
  13. package/dist/db/migrations/meta/_journal.json +21 -0
  14. package/dist/db/schema.d.ts +138 -1
  15. package/dist/db/schema.d.ts.map +1 -1
  16. package/dist/db/schema.js +39 -1
  17. package/dist/db/schema.js.map +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +9 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/plugins/headerSanitization.d.ts +15 -0
  22. package/dist/plugins/headerSanitization.d.ts.map +1 -0
  23. package/dist/plugins/headerSanitization.js +39 -0
  24. package/dist/plugins/headerSanitization.js.map +1 -0
  25. package/dist/plugins/mtls.d.ts +21 -2
  26. package/dist/plugins/mtls.d.ts.map +1 -1
  27. package/dist/plugins/mtls.js +94 -47
  28. package/dist/plugins/mtls.js.map +1 -1
  29. package/dist/plugins/rateLimit.d.ts +5 -4
  30. package/dist/plugins/rateLimit.d.ts.map +1 -1
  31. package/dist/plugins/rateLimit.js +11 -8
  32. package/dist/plugins/rateLimit.js.map +1 -1
  33. package/dist/repositories/application.d.ts +1 -1
  34. package/dist/repositories/application.d.ts.map +1 -1
  35. package/dist/repositories/application.js +8 -2
  36. package/dist/repositories/application.js.map +1 -1
  37. package/dist/repositories/session.d.ts +1 -0
  38. package/dist/repositories/session.d.ts.map +1 -1
  39. package/dist/repositories/types.d.ts +5 -1
  40. package/dist/repositories/types.d.ts.map +1 -1
  41. package/dist/routes/admin/organizations.d.ts.map +1 -1
  42. package/dist/routes/admin/organizations.js +31 -2
  43. package/dist/routes/admin/organizations.js.map +1 -1
  44. package/dist/routes/oauth.d.ts.map +1 -1
  45. package/dist/routes/oauth.js +38 -2
  46. package/dist/routes/oauth.js.map +1 -1
  47. package/dist/routes/oauth2.d.ts.map +1 -1
  48. package/dist/routes/oauth2.js +84 -11
  49. package/dist/routes/oauth2.js.map +1 -1
  50. package/dist/routes/saml.d.ts +24 -0
  51. package/dist/routes/saml.d.ts.map +1 -1
  52. package/dist/routes/saml.js +32 -3
  53. package/dist/routes/saml.js.map +1 -1
  54. package/dist/routes/serviceAccounts.d.ts.map +1 -1
  55. package/dist/routes/serviceAccounts.js +61 -1
  56. package/dist/routes/serviceAccounts.js.map +1 -1
  57. package/dist/routes/totp.d.ts.map +1 -1
  58. package/dist/routes/totp.js +4 -5
  59. package/dist/routes/totp.js.map +1 -1
  60. package/dist/sdk/index.d.ts.map +1 -1
  61. package/dist/sdk/index.js.map +1 -1
  62. package/dist/sdk/types.d.ts +4 -1
  63. package/dist/sdk/types.d.ts.map +1 -1
  64. package/dist/services/application/organization.d.ts +5 -1
  65. package/dist/services/application/organization.d.ts.map +1 -1
  66. package/dist/services/application/organization.js.map +1 -1
  67. package/dist/services/connectors/google.d.ts +18 -1
  68. package/dist/services/connectors/google.d.ts.map +1 -1
  69. package/dist/services/connectors/google.js +25 -3
  70. package/dist/services/connectors/google.js.map +1 -1
  71. package/dist/services/connectors/oidc.d.ts +14 -2
  72. package/dist/services/connectors/oidc.d.ts.map +1 -1
  73. package/dist/services/connectors/oidc.js +29 -3
  74. package/dist/services/connectors/oidc.js.map +1 -1
  75. package/dist/services/connectors/types.d.ts +13 -1
  76. package/dist/services/connectors/types.d.ts.map +1 -1
  77. package/dist/services/domain/authentication.d.ts.map +1 -1
  78. package/dist/services/domain/authentication.js +36 -19
  79. package/dist/services/domain/authentication.js.map +1 -1
  80. package/dist/services/domain/organization.d.ts +5 -1
  81. package/dist/services/domain/organization.d.ts.map +1 -1
  82. package/dist/services/domain/organization.js.map +1 -1
  83. package/dist/services/events/types.d.ts +1 -1
  84. package/dist/services/events/types.d.ts.map +1 -1
  85. package/dist/services/events/validate.d.ts.map +1 -1
  86. package/dist/services/events/validate.js +6 -0
  87. package/dist/services/events/validate.js.map +1 -1
  88. package/dist/services/magicLinks.d.ts.map +1 -1
  89. package/dist/services/magicLinks.js +13 -9
  90. package/dist/services/magicLinks.js.map +1 -1
  91. package/dist/services/oauth2.d.ts +72 -2
  92. package/dist/services/oauth2.d.ts.map +1 -1
  93. package/dist/services/oauth2.js +106 -6
  94. package/dist/services/oauth2.js.map +1 -1
  95. package/dist/services/redirectUri.d.ts +56 -0
  96. package/dist/services/redirectUri.d.ts.map +1 -0
  97. package/dist/services/redirectUri.js +129 -0
  98. package/dist/services/redirectUri.js.map +1 -0
  99. package/dist/services/serviceAccounts.d.ts +20 -0
  100. package/dist/services/serviceAccounts.d.ts.map +1 -1
  101. package/dist/services/serviceAccounts.js +47 -1
  102. package/dist/services/serviceAccounts.js.map +1 -1
  103. package/dist/services/sessionRevocation.d.ts +76 -0
  104. package/dist/services/sessionRevocation.d.ts.map +1 -0
  105. package/dist/services/sessionRevocation.js +86 -0
  106. package/dist/services/sessionRevocation.js.map +1 -0
  107. package/dist/services/singleUse.d.ts +68 -0
  108. package/dist/services/singleUse.d.ts.map +1 -0
  109. package/dist/services/singleUse.js +54 -0
  110. package/dist/services/singleUse.js.map +1 -0
  111. package/dist/services/smsOtp.d.ts.map +1 -1
  112. package/dist/services/smsOtp.js +12 -8
  113. package/dist/services/smsOtp.js.map +1 -1
  114. package/dist/services/tokens.d.ts +2 -0
  115. package/dist/services/tokens.d.ts.map +1 -1
  116. package/dist/services/tokens.js +5 -0
  117. package/dist/services/tokens.js.map +1 -1
  118. package/dist/services/trustedProxies.d.ts +90 -0
  119. package/dist/services/trustedProxies.d.ts.map +1 -0
  120. package/dist/services/trustedProxies.js +283 -0
  121. package/dist/services/trustedProxies.js.map +1 -0
  122. package/dist/setup-server.js +2 -1
  123. package/dist/setup-server.js.map +1 -1
  124. package/dist/types.d.ts +2 -2
  125. package/dist/types.d.ts.map +1 -1
  126. package/dist/types.js.map +1 -1
  127. package/package.json +4 -5
@@ -0,0 +1,4363 @@
1
+ {
2
+ "id": "2b35a6ee-258c-443a-a5b2-5f126f6708b5",
3
+ "prevId": "303fd6a8-304d-4553-bf7b-8e5319e60955",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.api_keys": {
8
+ "name": "api_keys",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "user_id": {
19
+ "name": "user_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": false
23
+ },
24
+ "service_account_id": {
25
+ "name": "service_account_id",
26
+ "type": "uuid",
27
+ "primaryKey": false,
28
+ "notNull": false
29
+ },
30
+ "org_id": {
31
+ "name": "org_id",
32
+ "type": "uuid",
33
+ "primaryKey": false,
34
+ "notNull": false
35
+ },
36
+ "app_id": {
37
+ "name": "app_id",
38
+ "type": "uuid",
39
+ "primaryKey": false,
40
+ "notNull": false
41
+ },
42
+ "name": {
43
+ "name": "name",
44
+ "type": "text",
45
+ "primaryKey": false,
46
+ "notNull": false
47
+ },
48
+ "prefix": {
49
+ "name": "prefix",
50
+ "type": "text",
51
+ "primaryKey": false,
52
+ "notNull": true
53
+ },
54
+ "key_hash": {
55
+ "name": "key_hash",
56
+ "type": "text",
57
+ "primaryKey": false,
58
+ "notNull": true
59
+ },
60
+ "scopes": {
61
+ "name": "scopes",
62
+ "type": "text[]",
63
+ "primaryKey": false,
64
+ "notNull": true,
65
+ "default": "'{\"api:read\"}'::text[]"
66
+ },
67
+ "last_used_at": {
68
+ "name": "last_used_at",
69
+ "type": "timestamp with time zone",
70
+ "primaryKey": false,
71
+ "notNull": false
72
+ },
73
+ "expires_at": {
74
+ "name": "expires_at",
75
+ "type": "timestamp with time zone",
76
+ "primaryKey": false,
77
+ "notNull": false
78
+ },
79
+ "revoked_at": {
80
+ "name": "revoked_at",
81
+ "type": "timestamp with time zone",
82
+ "primaryKey": false,
83
+ "notNull": false
84
+ },
85
+ "created_at": {
86
+ "name": "created_at",
87
+ "type": "timestamp with time zone",
88
+ "primaryKey": false,
89
+ "notNull": true,
90
+ "default": "now()"
91
+ }
92
+ },
93
+ "indexes": {
94
+ "api_keys_user_idx": {
95
+ "name": "api_keys_user_idx",
96
+ "columns": [
97
+ {
98
+ "expression": "user_id",
99
+ "isExpression": false,
100
+ "asc": true,
101
+ "nulls": "last"
102
+ }
103
+ ],
104
+ "isUnique": false,
105
+ "concurrently": false,
106
+ "method": "btree",
107
+ "with": {}
108
+ },
109
+ "api_keys_service_account_idx": {
110
+ "name": "api_keys_service_account_idx",
111
+ "columns": [
112
+ {
113
+ "expression": "service_account_id",
114
+ "isExpression": false,
115
+ "asc": true,
116
+ "nulls": "last"
117
+ }
118
+ ],
119
+ "isUnique": false,
120
+ "concurrently": false,
121
+ "method": "btree",
122
+ "with": {}
123
+ },
124
+ "api_keys_prefix_idx": {
125
+ "name": "api_keys_prefix_idx",
126
+ "columns": [
127
+ {
128
+ "expression": "prefix",
129
+ "isExpression": false,
130
+ "asc": true,
131
+ "nulls": "last"
132
+ }
133
+ ],
134
+ "isUnique": false,
135
+ "concurrently": false,
136
+ "method": "btree",
137
+ "with": {}
138
+ }
139
+ },
140
+ "foreignKeys": {
141
+ "api_keys_user_id_users_id_fk": {
142
+ "name": "api_keys_user_id_users_id_fk",
143
+ "tableFrom": "api_keys",
144
+ "tableTo": "users",
145
+ "columnsFrom": [
146
+ "user_id"
147
+ ],
148
+ "columnsTo": [
149
+ "id"
150
+ ],
151
+ "onDelete": "cascade",
152
+ "onUpdate": "no action"
153
+ },
154
+ "api_keys_service_account_id_service_accounts_id_fk": {
155
+ "name": "api_keys_service_account_id_service_accounts_id_fk",
156
+ "tableFrom": "api_keys",
157
+ "tableTo": "service_accounts",
158
+ "columnsFrom": [
159
+ "service_account_id"
160
+ ],
161
+ "columnsTo": [
162
+ "id"
163
+ ],
164
+ "onDelete": "cascade",
165
+ "onUpdate": "no action"
166
+ },
167
+ "api_keys_org_id_organizations_id_fk": {
168
+ "name": "api_keys_org_id_organizations_id_fk",
169
+ "tableFrom": "api_keys",
170
+ "tableTo": "organizations",
171
+ "columnsFrom": [
172
+ "org_id"
173
+ ],
174
+ "columnsTo": [
175
+ "id"
176
+ ],
177
+ "onDelete": "set null",
178
+ "onUpdate": "no action"
179
+ },
180
+ "api_keys_app_id_applications_id_fk": {
181
+ "name": "api_keys_app_id_applications_id_fk",
182
+ "tableFrom": "api_keys",
183
+ "tableTo": "applications",
184
+ "columnsFrom": [
185
+ "app_id"
186
+ ],
187
+ "columnsTo": [
188
+ "id"
189
+ ],
190
+ "onDelete": "set null",
191
+ "onUpdate": "no action"
192
+ }
193
+ },
194
+ "compositePrimaryKeys": {},
195
+ "uniqueConstraints": {},
196
+ "policies": {},
197
+ "checkConstraints": {},
198
+ "isRLSEnabled": false
199
+ },
200
+ "public.applications": {
201
+ "name": "applications",
202
+ "schema": "",
203
+ "columns": {
204
+ "id": {
205
+ "name": "id",
206
+ "type": "uuid",
207
+ "primaryKey": true,
208
+ "notNull": true,
209
+ "default": "gen_random_uuid()"
210
+ },
211
+ "org_id": {
212
+ "name": "org_id",
213
+ "type": "uuid",
214
+ "primaryKey": false,
215
+ "notNull": true
216
+ },
217
+ "client_id": {
218
+ "name": "client_id",
219
+ "type": "text",
220
+ "primaryKey": false,
221
+ "notNull": true
222
+ },
223
+ "client_secret_hash": {
224
+ "name": "client_secret_hash",
225
+ "type": "text",
226
+ "primaryKey": false,
227
+ "notNull": false
228
+ },
229
+ "client_type": {
230
+ "name": "client_type",
231
+ "type": "text",
232
+ "primaryKey": false,
233
+ "notNull": true,
234
+ "default": "'confidential'"
235
+ },
236
+ "allowed_scopes": {
237
+ "name": "allowed_scopes",
238
+ "type": "text[]",
239
+ "primaryKey": false,
240
+ "notNull": true,
241
+ "default": "'{}'::text[]"
242
+ },
243
+ "name": {
244
+ "name": "name",
245
+ "type": "text",
246
+ "primaryKey": false,
247
+ "notNull": true
248
+ },
249
+ "redirect_uris": {
250
+ "name": "redirect_uris",
251
+ "type": "text[]",
252
+ "primaryKey": false,
253
+ "notNull": true,
254
+ "default": "'{}'::text[]"
255
+ },
256
+ "allowed_origins": {
257
+ "name": "allowed_origins",
258
+ "type": "text[]",
259
+ "primaryKey": false,
260
+ "notNull": true,
261
+ "default": "'{}'::text[]"
262
+ },
263
+ "allowed_ips": {
264
+ "name": "allowed_ips",
265
+ "type": "text[]",
266
+ "primaryKey": false,
267
+ "notNull": true,
268
+ "default": "'{}'::text[]"
269
+ },
270
+ "blocked_ips": {
271
+ "name": "blocked_ips",
272
+ "type": "text[]",
273
+ "primaryKey": false,
274
+ "notNull": true,
275
+ "default": "'{}'::text[]"
276
+ },
277
+ "branding": {
278
+ "name": "branding",
279
+ "type": "jsonb",
280
+ "primaryKey": false,
281
+ "notNull": true,
282
+ "default": "'{}'::jsonb"
283
+ },
284
+ "is_active": {
285
+ "name": "is_active",
286
+ "type": "boolean",
287
+ "primaryKey": false,
288
+ "notNull": true,
289
+ "default": true
290
+ },
291
+ "created_at": {
292
+ "name": "created_at",
293
+ "type": "timestamp with time zone",
294
+ "primaryKey": false,
295
+ "notNull": true,
296
+ "default": "now()"
297
+ },
298
+ "updated_at": {
299
+ "name": "updated_at",
300
+ "type": "timestamp with time zone",
301
+ "primaryKey": false,
302
+ "notNull": true,
303
+ "default": "now()"
304
+ }
305
+ },
306
+ "indexes": {
307
+ "applications_org_idx": {
308
+ "name": "applications_org_idx",
309
+ "columns": [
310
+ {
311
+ "expression": "org_id",
312
+ "isExpression": false,
313
+ "asc": true,
314
+ "nulls": "last"
315
+ }
316
+ ],
317
+ "isUnique": false,
318
+ "concurrently": false,
319
+ "method": "btree",
320
+ "with": {}
321
+ },
322
+ "applications_client_id_idx": {
323
+ "name": "applications_client_id_idx",
324
+ "columns": [
325
+ {
326
+ "expression": "client_id",
327
+ "isExpression": false,
328
+ "asc": true,
329
+ "nulls": "last"
330
+ }
331
+ ],
332
+ "isUnique": false,
333
+ "concurrently": false,
334
+ "method": "btree",
335
+ "with": {}
336
+ }
337
+ },
338
+ "foreignKeys": {
339
+ "applications_org_id_organizations_id_fk": {
340
+ "name": "applications_org_id_organizations_id_fk",
341
+ "tableFrom": "applications",
342
+ "tableTo": "organizations",
343
+ "columnsFrom": [
344
+ "org_id"
345
+ ],
346
+ "columnsTo": [
347
+ "id"
348
+ ],
349
+ "onDelete": "cascade",
350
+ "onUpdate": "no action"
351
+ }
352
+ },
353
+ "compositePrimaryKeys": {},
354
+ "uniqueConstraints": {
355
+ "applications_client_id_unique": {
356
+ "name": "applications_client_id_unique",
357
+ "nullsNotDistinct": false,
358
+ "columns": [
359
+ "client_id"
360
+ ]
361
+ }
362
+ },
363
+ "policies": {},
364
+ "checkConstraints": {
365
+ "applications_client_type_check": {
366
+ "name": "applications_client_type_check",
367
+ "value": "\"applications\".\"client_type\" in ('confidential', 'public')"
368
+ },
369
+ "applications_public_client_no_secret_check": {
370
+ "name": "applications_public_client_no_secret_check",
371
+ "value": "(\"applications\".\"client_type\" = 'public' and \"applications\".\"client_secret_hash\" is null) or \"applications\".\"client_type\" <> 'public'"
372
+ }
373
+ },
374
+ "isRLSEnabled": false
375
+ },
376
+ "public.audit_log": {
377
+ "name": "audit_log",
378
+ "schema": "",
379
+ "columns": {
380
+ "id": {
381
+ "name": "id",
382
+ "type": "uuid",
383
+ "primaryKey": true,
384
+ "notNull": true,
385
+ "default": "gen_random_uuid()"
386
+ },
387
+ "user_id": {
388
+ "name": "user_id",
389
+ "type": "uuid",
390
+ "primaryKey": false,
391
+ "notNull": false
392
+ },
393
+ "org_id": {
394
+ "name": "org_id",
395
+ "type": "uuid",
396
+ "primaryKey": false,
397
+ "notNull": false
398
+ },
399
+ "app_id": {
400
+ "name": "app_id",
401
+ "type": "uuid",
402
+ "primaryKey": false,
403
+ "notNull": false
404
+ },
405
+ "request_id": {
406
+ "name": "request_id",
407
+ "type": "text",
408
+ "primaryKey": false,
409
+ "notNull": false
410
+ },
411
+ "event": {
412
+ "name": "event",
413
+ "type": "varchar(64)",
414
+ "primaryKey": false,
415
+ "notNull": true
416
+ },
417
+ "ip_address": {
418
+ "name": "ip_address",
419
+ "type": "text",
420
+ "primaryKey": false,
421
+ "notNull": false
422
+ },
423
+ "user_agent": {
424
+ "name": "user_agent",
425
+ "type": "text",
426
+ "primaryKey": false,
427
+ "notNull": false
428
+ },
429
+ "metadata": {
430
+ "name": "metadata",
431
+ "type": "jsonb",
432
+ "primaryKey": false,
433
+ "notNull": false
434
+ },
435
+ "created_at": {
436
+ "name": "created_at",
437
+ "type": "timestamp with time zone",
438
+ "primaryKey": false,
439
+ "notNull": true,
440
+ "default": "now()"
441
+ }
442
+ },
443
+ "indexes": {
444
+ "audit_log_user_idx": {
445
+ "name": "audit_log_user_idx",
446
+ "columns": [
447
+ {
448
+ "expression": "user_id",
449
+ "isExpression": false,
450
+ "asc": true,
451
+ "nulls": "last"
452
+ }
453
+ ],
454
+ "isUnique": false,
455
+ "concurrently": false,
456
+ "method": "btree",
457
+ "with": {}
458
+ },
459
+ "audit_log_event_idx": {
460
+ "name": "audit_log_event_idx",
461
+ "columns": [
462
+ {
463
+ "expression": "event",
464
+ "isExpression": false,
465
+ "asc": true,
466
+ "nulls": "last"
467
+ }
468
+ ],
469
+ "isUnique": false,
470
+ "concurrently": false,
471
+ "method": "btree",
472
+ "with": {}
473
+ },
474
+ "audit_log_created_at_idx": {
475
+ "name": "audit_log_created_at_idx",
476
+ "columns": [
477
+ {
478
+ "expression": "created_at",
479
+ "isExpression": false,
480
+ "asc": true,
481
+ "nulls": "last"
482
+ }
483
+ ],
484
+ "isUnique": false,
485
+ "concurrently": false,
486
+ "method": "btree",
487
+ "with": {}
488
+ },
489
+ "audit_log_org_idx": {
490
+ "name": "audit_log_org_idx",
491
+ "columns": [
492
+ {
493
+ "expression": "org_id",
494
+ "isExpression": false,
495
+ "asc": true,
496
+ "nulls": "last"
497
+ }
498
+ ],
499
+ "isUnique": false,
500
+ "concurrently": false,
501
+ "method": "btree",
502
+ "with": {}
503
+ },
504
+ "audit_log_app_idx": {
505
+ "name": "audit_log_app_idx",
506
+ "columns": [
507
+ {
508
+ "expression": "app_id",
509
+ "isExpression": false,
510
+ "asc": true,
511
+ "nulls": "last"
512
+ }
513
+ ],
514
+ "isUnique": false,
515
+ "concurrently": false,
516
+ "method": "btree",
517
+ "with": {}
518
+ }
519
+ },
520
+ "foreignKeys": {
521
+ "audit_log_user_id_users_id_fk": {
522
+ "name": "audit_log_user_id_users_id_fk",
523
+ "tableFrom": "audit_log",
524
+ "tableTo": "users",
525
+ "columnsFrom": [
526
+ "user_id"
527
+ ],
528
+ "columnsTo": [
529
+ "id"
530
+ ],
531
+ "onDelete": "set null",
532
+ "onUpdate": "no action"
533
+ },
534
+ "audit_log_org_id_organizations_id_fk": {
535
+ "name": "audit_log_org_id_organizations_id_fk",
536
+ "tableFrom": "audit_log",
537
+ "tableTo": "organizations",
538
+ "columnsFrom": [
539
+ "org_id"
540
+ ],
541
+ "columnsTo": [
542
+ "id"
543
+ ],
544
+ "onDelete": "set null",
545
+ "onUpdate": "no action"
546
+ },
547
+ "audit_log_app_id_applications_id_fk": {
548
+ "name": "audit_log_app_id_applications_id_fk",
549
+ "tableFrom": "audit_log",
550
+ "tableTo": "applications",
551
+ "columnsFrom": [
552
+ "app_id"
553
+ ],
554
+ "columnsTo": [
555
+ "id"
556
+ ],
557
+ "onDelete": "set null",
558
+ "onUpdate": "no action"
559
+ }
560
+ },
561
+ "compositePrimaryKeys": {},
562
+ "uniqueConstraints": {},
563
+ "policies": {},
564
+ "checkConstraints": {},
565
+ "isRLSEnabled": false
566
+ },
567
+ "public.email_verification_tokens": {
568
+ "name": "email_verification_tokens",
569
+ "schema": "",
570
+ "columns": {
571
+ "id": {
572
+ "name": "id",
573
+ "type": "uuid",
574
+ "primaryKey": true,
575
+ "notNull": true,
576
+ "default": "gen_random_uuid()"
577
+ },
578
+ "user_id": {
579
+ "name": "user_id",
580
+ "type": "uuid",
581
+ "primaryKey": false,
582
+ "notNull": true
583
+ },
584
+ "token_hash": {
585
+ "name": "token_hash",
586
+ "type": "text",
587
+ "primaryKey": false,
588
+ "notNull": true
589
+ },
590
+ "used_at": {
591
+ "name": "used_at",
592
+ "type": "timestamp with time zone",
593
+ "primaryKey": false,
594
+ "notNull": false
595
+ },
596
+ "expires_at": {
597
+ "name": "expires_at",
598
+ "type": "timestamp with time zone",
599
+ "primaryKey": false,
600
+ "notNull": true
601
+ },
602
+ "created_at": {
603
+ "name": "created_at",
604
+ "type": "timestamp with time zone",
605
+ "primaryKey": false,
606
+ "notNull": true,
607
+ "default": "now()"
608
+ }
609
+ },
610
+ "indexes": {
611
+ "email_verification_user_idx": {
612
+ "name": "email_verification_user_idx",
613
+ "columns": [
614
+ {
615
+ "expression": "user_id",
616
+ "isExpression": false,
617
+ "asc": true,
618
+ "nulls": "last"
619
+ }
620
+ ],
621
+ "isUnique": false,
622
+ "concurrently": false,
623
+ "method": "btree",
624
+ "with": {}
625
+ },
626
+ "email_verification_hash_idx": {
627
+ "name": "email_verification_hash_idx",
628
+ "columns": [
629
+ {
630
+ "expression": "token_hash",
631
+ "isExpression": false,
632
+ "asc": true,
633
+ "nulls": "last"
634
+ }
635
+ ],
636
+ "isUnique": false,
637
+ "concurrently": false,
638
+ "method": "btree",
639
+ "with": {}
640
+ }
641
+ },
642
+ "foreignKeys": {
643
+ "email_verification_tokens_user_id_users_id_fk": {
644
+ "name": "email_verification_tokens_user_id_users_id_fk",
645
+ "tableFrom": "email_verification_tokens",
646
+ "tableTo": "users",
647
+ "columnsFrom": [
648
+ "user_id"
649
+ ],
650
+ "columnsTo": [
651
+ "id"
652
+ ],
653
+ "onDelete": "cascade",
654
+ "onUpdate": "no action"
655
+ }
656
+ },
657
+ "compositePrimaryKeys": {},
658
+ "uniqueConstraints": {},
659
+ "policies": {},
660
+ "checkConstraints": {},
661
+ "isRLSEnabled": false
662
+ },
663
+ "public.feature_flags": {
664
+ "name": "feature_flags",
665
+ "schema": "",
666
+ "columns": {
667
+ "id": {
668
+ "name": "id",
669
+ "type": "uuid",
670
+ "primaryKey": true,
671
+ "notNull": true,
672
+ "default": "gen_random_uuid()"
673
+ },
674
+ "key": {
675
+ "name": "key",
676
+ "type": "text",
677
+ "primaryKey": false,
678
+ "notNull": true
679
+ },
680
+ "enabled": {
681
+ "name": "enabled",
682
+ "type": "boolean",
683
+ "primaryKey": false,
684
+ "notNull": true,
685
+ "default": false
686
+ },
687
+ "description": {
688
+ "name": "description",
689
+ "type": "text",
690
+ "primaryKey": false,
691
+ "notNull": false
692
+ },
693
+ "updated_at": {
694
+ "name": "updated_at",
695
+ "type": "timestamp with time zone",
696
+ "primaryKey": false,
697
+ "notNull": true,
698
+ "default": "now()"
699
+ }
700
+ },
701
+ "indexes": {
702
+ "feature_flags_key_idx": {
703
+ "name": "feature_flags_key_idx",
704
+ "columns": [
705
+ {
706
+ "expression": "key",
707
+ "isExpression": false,
708
+ "asc": true,
709
+ "nulls": "last"
710
+ }
711
+ ],
712
+ "isUnique": false,
713
+ "concurrently": false,
714
+ "method": "btree",
715
+ "with": {}
716
+ }
717
+ },
718
+ "foreignKeys": {},
719
+ "compositePrimaryKeys": {},
720
+ "uniqueConstraints": {
721
+ "feature_flags_key_unique": {
722
+ "name": "feature_flags_key_unique",
723
+ "nullsNotDistinct": false,
724
+ "columns": [
725
+ "key"
726
+ ]
727
+ }
728
+ },
729
+ "policies": {},
730
+ "checkConstraints": {},
731
+ "isRLSEnabled": false
732
+ },
733
+ "public.identity_providers": {
734
+ "name": "identity_providers",
735
+ "schema": "",
736
+ "columns": {
737
+ "id": {
738
+ "name": "id",
739
+ "type": "uuid",
740
+ "primaryKey": true,
741
+ "notNull": true,
742
+ "default": "gen_random_uuid()"
743
+ },
744
+ "org_id": {
745
+ "name": "org_id",
746
+ "type": "uuid",
747
+ "primaryKey": false,
748
+ "notNull": true
749
+ },
750
+ "provider_type": {
751
+ "name": "provider_type",
752
+ "type": "text",
753
+ "primaryKey": false,
754
+ "notNull": true
755
+ },
756
+ "name": {
757
+ "name": "name",
758
+ "type": "text",
759
+ "primaryKey": false,
760
+ "notNull": true
761
+ },
762
+ "issuer": {
763
+ "name": "issuer",
764
+ "type": "text",
765
+ "primaryKey": false,
766
+ "notNull": false
767
+ },
768
+ "authorization_endpoint": {
769
+ "name": "authorization_endpoint",
770
+ "type": "text",
771
+ "primaryKey": false,
772
+ "notNull": false
773
+ },
774
+ "token_endpoint": {
775
+ "name": "token_endpoint",
776
+ "type": "text",
777
+ "primaryKey": false,
778
+ "notNull": false
779
+ },
780
+ "userinfo_endpoint": {
781
+ "name": "userinfo_endpoint",
782
+ "type": "text",
783
+ "primaryKey": false,
784
+ "notNull": false
785
+ },
786
+ "jwks_uri": {
787
+ "name": "jwks_uri",
788
+ "type": "text",
789
+ "primaryKey": false,
790
+ "notNull": false
791
+ },
792
+ "client_id": {
793
+ "name": "client_id",
794
+ "type": "text",
795
+ "primaryKey": false,
796
+ "notNull": false
797
+ },
798
+ "client_secret_encrypted": {
799
+ "name": "client_secret_encrypted",
800
+ "type": "text",
801
+ "primaryKey": false,
802
+ "notNull": false
803
+ },
804
+ "scopes": {
805
+ "name": "scopes",
806
+ "type": "text[]",
807
+ "primaryKey": false,
808
+ "notNull": true,
809
+ "default": "'{\"openid\",\"profile\",\"email\"}'::text[]"
810
+ },
811
+ "attribute_mapping": {
812
+ "name": "attribute_mapping",
813
+ "type": "jsonb",
814
+ "primaryKey": false,
815
+ "notNull": true,
816
+ "default": "'{}'::jsonb"
817
+ },
818
+ "is_active": {
819
+ "name": "is_active",
820
+ "type": "boolean",
821
+ "primaryKey": false,
822
+ "notNull": true,
823
+ "default": true
824
+ },
825
+ "is_federation": {
826
+ "name": "is_federation",
827
+ "type": "boolean",
828
+ "primaryKey": false,
829
+ "notNull": true,
830
+ "default": true
831
+ },
832
+ "created_at": {
833
+ "name": "created_at",
834
+ "type": "timestamp with time zone",
835
+ "primaryKey": false,
836
+ "notNull": true,
837
+ "default": "now()"
838
+ },
839
+ "updated_at": {
840
+ "name": "updated_at",
841
+ "type": "timestamp with time zone",
842
+ "primaryKey": false,
843
+ "notNull": true,
844
+ "default": "now()"
845
+ }
846
+ },
847
+ "indexes": {
848
+ "identity_providers_org_idx": {
849
+ "name": "identity_providers_org_idx",
850
+ "columns": [
851
+ {
852
+ "expression": "org_id",
853
+ "isExpression": false,
854
+ "asc": true,
855
+ "nulls": "last"
856
+ }
857
+ ],
858
+ "isUnique": false,
859
+ "concurrently": false,
860
+ "method": "btree",
861
+ "with": {}
862
+ },
863
+ "identity_providers_type_idx": {
864
+ "name": "identity_providers_type_idx",
865
+ "columns": [
866
+ {
867
+ "expression": "provider_type",
868
+ "isExpression": false,
869
+ "asc": true,
870
+ "nulls": "last"
871
+ }
872
+ ],
873
+ "isUnique": false,
874
+ "concurrently": false,
875
+ "method": "btree",
876
+ "with": {}
877
+ }
878
+ },
879
+ "foreignKeys": {
880
+ "identity_providers_org_id_organizations_id_fk": {
881
+ "name": "identity_providers_org_id_organizations_id_fk",
882
+ "tableFrom": "identity_providers",
883
+ "tableTo": "organizations",
884
+ "columnsFrom": [
885
+ "org_id"
886
+ ],
887
+ "columnsTo": [
888
+ "id"
889
+ ],
890
+ "onDelete": "cascade",
891
+ "onUpdate": "no action"
892
+ }
893
+ },
894
+ "compositePrimaryKeys": {},
895
+ "uniqueConstraints": {},
896
+ "policies": {},
897
+ "checkConstraints": {},
898
+ "isRLSEnabled": false
899
+ },
900
+ "public.magic_links": {
901
+ "name": "magic_links",
902
+ "schema": "",
903
+ "columns": {
904
+ "id": {
905
+ "name": "id",
906
+ "type": "uuid",
907
+ "primaryKey": true,
908
+ "notNull": true,
909
+ "default": "gen_random_uuid()"
910
+ },
911
+ "user_id": {
912
+ "name": "user_id",
913
+ "type": "uuid",
914
+ "primaryKey": false,
915
+ "notNull": true
916
+ },
917
+ "token_hash": {
918
+ "name": "token_hash",
919
+ "type": "text",
920
+ "primaryKey": false,
921
+ "notNull": true
922
+ },
923
+ "used_at": {
924
+ "name": "used_at",
925
+ "type": "timestamp with time zone",
926
+ "primaryKey": false,
927
+ "notNull": false
928
+ },
929
+ "expires_at": {
930
+ "name": "expires_at",
931
+ "type": "timestamp with time zone",
932
+ "primaryKey": false,
933
+ "notNull": true
934
+ },
935
+ "created_at": {
936
+ "name": "created_at",
937
+ "type": "timestamp with time zone",
938
+ "primaryKey": false,
939
+ "notNull": true,
940
+ "default": "now()"
941
+ }
942
+ },
943
+ "indexes": {
944
+ "magic_links_user_idx": {
945
+ "name": "magic_links_user_idx",
946
+ "columns": [
947
+ {
948
+ "expression": "user_id",
949
+ "isExpression": false,
950
+ "asc": true,
951
+ "nulls": "last"
952
+ }
953
+ ],
954
+ "isUnique": false,
955
+ "concurrently": false,
956
+ "method": "btree",
957
+ "with": {}
958
+ },
959
+ "magic_links_hash_idx": {
960
+ "name": "magic_links_hash_idx",
961
+ "columns": [
962
+ {
963
+ "expression": "token_hash",
964
+ "isExpression": false,
965
+ "asc": true,
966
+ "nulls": "last"
967
+ }
968
+ ],
969
+ "isUnique": false,
970
+ "concurrently": false,
971
+ "method": "btree",
972
+ "with": {}
973
+ }
974
+ },
975
+ "foreignKeys": {
976
+ "magic_links_user_id_users_id_fk": {
977
+ "name": "magic_links_user_id_users_id_fk",
978
+ "tableFrom": "magic_links",
979
+ "tableTo": "users",
980
+ "columnsFrom": [
981
+ "user_id"
982
+ ],
983
+ "columnsTo": [
984
+ "id"
985
+ ],
986
+ "onDelete": "cascade",
987
+ "onUpdate": "no action"
988
+ }
989
+ },
990
+ "compositePrimaryKeys": {},
991
+ "uniqueConstraints": {},
992
+ "policies": {},
993
+ "checkConstraints": {},
994
+ "isRLSEnabled": false
995
+ },
996
+ "public.mfa_challenges": {
997
+ "name": "mfa_challenges",
998
+ "schema": "",
999
+ "columns": {
1000
+ "id": {
1001
+ "name": "id",
1002
+ "type": "uuid",
1003
+ "primaryKey": true,
1004
+ "notNull": true,
1005
+ "default": "gen_random_uuid()"
1006
+ },
1007
+ "challenge_hash": {
1008
+ "name": "challenge_hash",
1009
+ "type": "text",
1010
+ "primaryKey": false,
1011
+ "notNull": true
1012
+ },
1013
+ "user_id": {
1014
+ "name": "user_id",
1015
+ "type": "uuid",
1016
+ "primaryKey": false,
1017
+ "notNull": true
1018
+ },
1019
+ "flow": {
1020
+ "name": "flow",
1021
+ "type": "text",
1022
+ "primaryKey": false,
1023
+ "notNull": true
1024
+ },
1025
+ "client_id": {
1026
+ "name": "client_id",
1027
+ "type": "text",
1028
+ "primaryKey": false,
1029
+ "notNull": false
1030
+ },
1031
+ "status": {
1032
+ "name": "status",
1033
+ "type": "text",
1034
+ "primaryKey": false,
1035
+ "notNull": true,
1036
+ "default": "'requires_mfa'"
1037
+ },
1038
+ "attempts": {
1039
+ "name": "attempts",
1040
+ "type": "integer",
1041
+ "primaryKey": false,
1042
+ "notNull": true,
1043
+ "default": 0
1044
+ },
1045
+ "max_attempts": {
1046
+ "name": "max_attempts",
1047
+ "type": "integer",
1048
+ "primaryKey": false,
1049
+ "notNull": true,
1050
+ "default": 5
1051
+ },
1052
+ "ip_address": {
1053
+ "name": "ip_address",
1054
+ "type": "text",
1055
+ "primaryKey": false,
1056
+ "notNull": false
1057
+ },
1058
+ "user_agent": {
1059
+ "name": "user_agent",
1060
+ "type": "text",
1061
+ "primaryKey": false,
1062
+ "notNull": false
1063
+ },
1064
+ "expires_at": {
1065
+ "name": "expires_at",
1066
+ "type": "timestamp with time zone",
1067
+ "primaryKey": false,
1068
+ "notNull": true
1069
+ },
1070
+ "consumed_at": {
1071
+ "name": "consumed_at",
1072
+ "type": "timestamp with time zone",
1073
+ "primaryKey": false,
1074
+ "notNull": false
1075
+ },
1076
+ "created_at": {
1077
+ "name": "created_at",
1078
+ "type": "timestamp with time zone",
1079
+ "primaryKey": false,
1080
+ "notNull": true,
1081
+ "default": "now()"
1082
+ }
1083
+ },
1084
+ "indexes": {
1085
+ "mfa_challenges_user_idx": {
1086
+ "name": "mfa_challenges_user_idx",
1087
+ "columns": [
1088
+ {
1089
+ "expression": "user_id",
1090
+ "isExpression": false,
1091
+ "asc": true,
1092
+ "nulls": "last"
1093
+ }
1094
+ ],
1095
+ "isUnique": false,
1096
+ "concurrently": false,
1097
+ "method": "btree",
1098
+ "with": {}
1099
+ },
1100
+ "mfa_challenges_status_idx": {
1101
+ "name": "mfa_challenges_status_idx",
1102
+ "columns": [
1103
+ {
1104
+ "expression": "status",
1105
+ "isExpression": false,
1106
+ "asc": true,
1107
+ "nulls": "last"
1108
+ }
1109
+ ],
1110
+ "isUnique": false,
1111
+ "concurrently": false,
1112
+ "method": "btree",
1113
+ "with": {}
1114
+ }
1115
+ },
1116
+ "foreignKeys": {
1117
+ "mfa_challenges_user_id_users_id_fk": {
1118
+ "name": "mfa_challenges_user_id_users_id_fk",
1119
+ "tableFrom": "mfa_challenges",
1120
+ "tableTo": "users",
1121
+ "columnsFrom": [
1122
+ "user_id"
1123
+ ],
1124
+ "columnsTo": [
1125
+ "id"
1126
+ ],
1127
+ "onDelete": "cascade",
1128
+ "onUpdate": "no action"
1129
+ }
1130
+ },
1131
+ "compositePrimaryKeys": {},
1132
+ "uniqueConstraints": {
1133
+ "mfa_challenges_challenge_hash_unique": {
1134
+ "name": "mfa_challenges_challenge_hash_unique",
1135
+ "nullsNotDistinct": false,
1136
+ "columns": [
1137
+ "challenge_hash"
1138
+ ]
1139
+ }
1140
+ },
1141
+ "policies": {},
1142
+ "checkConstraints": {
1143
+ "mfa_challenges_flow_check": {
1144
+ "name": "mfa_challenges_flow_check",
1145
+ "value": "flow in ('login', 'token_login')"
1146
+ },
1147
+ "mfa_challenges_status_check": {
1148
+ "name": "mfa_challenges_status_check",
1149
+ "value": "status in ('requires_mfa', 'consumed', 'failed', 'expired')"
1150
+ }
1151
+ },
1152
+ "isRLSEnabled": false
1153
+ },
1154
+ "public.oauth2_authorization_codes": {
1155
+ "name": "oauth2_authorization_codes",
1156
+ "schema": "",
1157
+ "columns": {
1158
+ "id": {
1159
+ "name": "id",
1160
+ "type": "uuid",
1161
+ "primaryKey": true,
1162
+ "notNull": true,
1163
+ "default": "gen_random_uuid()"
1164
+ },
1165
+ "app_id": {
1166
+ "name": "app_id",
1167
+ "type": "uuid",
1168
+ "primaryKey": false,
1169
+ "notNull": true
1170
+ },
1171
+ "user_id": {
1172
+ "name": "user_id",
1173
+ "type": "uuid",
1174
+ "primaryKey": false,
1175
+ "notNull": true
1176
+ },
1177
+ "code_hash": {
1178
+ "name": "code_hash",
1179
+ "type": "text",
1180
+ "primaryKey": false,
1181
+ "notNull": true
1182
+ },
1183
+ "challenge": {
1184
+ "name": "challenge",
1185
+ "type": "text",
1186
+ "primaryKey": false,
1187
+ "notNull": false
1188
+ },
1189
+ "challenge_method": {
1190
+ "name": "challenge_method",
1191
+ "type": "text",
1192
+ "primaryKey": false,
1193
+ "notNull": false
1194
+ },
1195
+ "redirect_uri": {
1196
+ "name": "redirect_uri",
1197
+ "type": "text",
1198
+ "primaryKey": false,
1199
+ "notNull": false
1200
+ },
1201
+ "scopes": {
1202
+ "name": "scopes",
1203
+ "type": "text[]",
1204
+ "primaryKey": false,
1205
+ "notNull": true,
1206
+ "default": "'{}'::text[]"
1207
+ },
1208
+ "nonce": {
1209
+ "name": "nonce",
1210
+ "type": "text",
1211
+ "primaryKey": false,
1212
+ "notNull": false
1213
+ },
1214
+ "mfa_factor": {
1215
+ "name": "mfa_factor",
1216
+ "type": "text",
1217
+ "primaryKey": false,
1218
+ "notNull": false
1219
+ },
1220
+ "expires_at": {
1221
+ "name": "expires_at",
1222
+ "type": "timestamp with time zone",
1223
+ "primaryKey": false,
1224
+ "notNull": true
1225
+ },
1226
+ "used_at": {
1227
+ "name": "used_at",
1228
+ "type": "timestamp with time zone",
1229
+ "primaryKey": false,
1230
+ "notNull": false
1231
+ },
1232
+ "created_at": {
1233
+ "name": "created_at",
1234
+ "type": "timestamp with time zone",
1235
+ "primaryKey": false,
1236
+ "notNull": true,
1237
+ "default": "now()"
1238
+ }
1239
+ },
1240
+ "indexes": {
1241
+ "oauth2_authorization_codes_app_idx": {
1242
+ "name": "oauth2_authorization_codes_app_idx",
1243
+ "columns": [
1244
+ {
1245
+ "expression": "app_id",
1246
+ "isExpression": false,
1247
+ "asc": true,
1248
+ "nulls": "last"
1249
+ }
1250
+ ],
1251
+ "isUnique": false,
1252
+ "concurrently": false,
1253
+ "method": "btree",
1254
+ "with": {}
1255
+ },
1256
+ "oauth2_authorization_codes_user_idx": {
1257
+ "name": "oauth2_authorization_codes_user_idx",
1258
+ "columns": [
1259
+ {
1260
+ "expression": "user_id",
1261
+ "isExpression": false,
1262
+ "asc": true,
1263
+ "nulls": "last"
1264
+ }
1265
+ ],
1266
+ "isUnique": false,
1267
+ "concurrently": false,
1268
+ "method": "btree",
1269
+ "with": {}
1270
+ },
1271
+ "oauth2_authorization_codes_hash_idx": {
1272
+ "name": "oauth2_authorization_codes_hash_idx",
1273
+ "columns": [
1274
+ {
1275
+ "expression": "code_hash",
1276
+ "isExpression": false,
1277
+ "asc": true,
1278
+ "nulls": "last"
1279
+ }
1280
+ ],
1281
+ "isUnique": false,
1282
+ "concurrently": false,
1283
+ "method": "btree",
1284
+ "with": {}
1285
+ }
1286
+ },
1287
+ "foreignKeys": {
1288
+ "oauth2_authorization_codes_app_id_applications_id_fk": {
1289
+ "name": "oauth2_authorization_codes_app_id_applications_id_fk",
1290
+ "tableFrom": "oauth2_authorization_codes",
1291
+ "tableTo": "applications",
1292
+ "columnsFrom": [
1293
+ "app_id"
1294
+ ],
1295
+ "columnsTo": [
1296
+ "id"
1297
+ ],
1298
+ "onDelete": "cascade",
1299
+ "onUpdate": "no action"
1300
+ },
1301
+ "oauth2_authorization_codes_user_id_users_id_fk": {
1302
+ "name": "oauth2_authorization_codes_user_id_users_id_fk",
1303
+ "tableFrom": "oauth2_authorization_codes",
1304
+ "tableTo": "users",
1305
+ "columnsFrom": [
1306
+ "user_id"
1307
+ ],
1308
+ "columnsTo": [
1309
+ "id"
1310
+ ],
1311
+ "onDelete": "cascade",
1312
+ "onUpdate": "no action"
1313
+ }
1314
+ },
1315
+ "compositePrimaryKeys": {},
1316
+ "uniqueConstraints": {},
1317
+ "policies": {},
1318
+ "checkConstraints": {
1319
+ "oauth2_authorization_codes_mfa_factor_check": {
1320
+ "name": "oauth2_authorization_codes_mfa_factor_check",
1321
+ "value": "mfa_factor is null or mfa_factor in ('totp', 'backup_code', 'webauthn', 'session')"
1322
+ }
1323
+ },
1324
+ "isRLSEnabled": false
1325
+ },
1326
+ "public.oauth2_consents": {
1327
+ "name": "oauth2_consents",
1328
+ "schema": "",
1329
+ "columns": {
1330
+ "id": {
1331
+ "name": "id",
1332
+ "type": "uuid",
1333
+ "primaryKey": true,
1334
+ "notNull": true,
1335
+ "default": "gen_random_uuid()"
1336
+ },
1337
+ "app_id": {
1338
+ "name": "app_id",
1339
+ "type": "uuid",
1340
+ "primaryKey": false,
1341
+ "notNull": true
1342
+ },
1343
+ "user_id": {
1344
+ "name": "user_id",
1345
+ "type": "uuid",
1346
+ "primaryKey": false,
1347
+ "notNull": true
1348
+ },
1349
+ "scopes": {
1350
+ "name": "scopes",
1351
+ "type": "text[]",
1352
+ "primaryKey": false,
1353
+ "notNull": true,
1354
+ "default": "'{}'::text[]"
1355
+ },
1356
+ "granted_at": {
1357
+ "name": "granted_at",
1358
+ "type": "timestamp with time zone",
1359
+ "primaryKey": false,
1360
+ "notNull": true,
1361
+ "default": "now()"
1362
+ },
1363
+ "revoked_at": {
1364
+ "name": "revoked_at",
1365
+ "type": "timestamp with time zone",
1366
+ "primaryKey": false,
1367
+ "notNull": false
1368
+ }
1369
+ },
1370
+ "indexes": {
1371
+ "oauth2_consents_app_idx": {
1372
+ "name": "oauth2_consents_app_idx",
1373
+ "columns": [
1374
+ {
1375
+ "expression": "app_id",
1376
+ "isExpression": false,
1377
+ "asc": true,
1378
+ "nulls": "last"
1379
+ }
1380
+ ],
1381
+ "isUnique": false,
1382
+ "concurrently": false,
1383
+ "method": "btree",
1384
+ "with": {}
1385
+ },
1386
+ "oauth2_consents_user_idx": {
1387
+ "name": "oauth2_consents_user_idx",
1388
+ "columns": [
1389
+ {
1390
+ "expression": "user_id",
1391
+ "isExpression": false,
1392
+ "asc": true,
1393
+ "nulls": "last"
1394
+ }
1395
+ ],
1396
+ "isUnique": false,
1397
+ "concurrently": false,
1398
+ "method": "btree",
1399
+ "with": {}
1400
+ }
1401
+ },
1402
+ "foreignKeys": {
1403
+ "oauth2_consents_app_id_applications_id_fk": {
1404
+ "name": "oauth2_consents_app_id_applications_id_fk",
1405
+ "tableFrom": "oauth2_consents",
1406
+ "tableTo": "applications",
1407
+ "columnsFrom": [
1408
+ "app_id"
1409
+ ],
1410
+ "columnsTo": [
1411
+ "id"
1412
+ ],
1413
+ "onDelete": "cascade",
1414
+ "onUpdate": "no action"
1415
+ },
1416
+ "oauth2_consents_user_id_users_id_fk": {
1417
+ "name": "oauth2_consents_user_id_users_id_fk",
1418
+ "tableFrom": "oauth2_consents",
1419
+ "tableTo": "users",
1420
+ "columnsFrom": [
1421
+ "user_id"
1422
+ ],
1423
+ "columnsTo": [
1424
+ "id"
1425
+ ],
1426
+ "onDelete": "cascade",
1427
+ "onUpdate": "no action"
1428
+ }
1429
+ },
1430
+ "compositePrimaryKeys": {},
1431
+ "uniqueConstraints": {
1432
+ "oauth2_consents_unique": {
1433
+ "name": "oauth2_consents_unique",
1434
+ "nullsNotDistinct": false,
1435
+ "columns": [
1436
+ "app_id",
1437
+ "user_id"
1438
+ ]
1439
+ }
1440
+ },
1441
+ "policies": {},
1442
+ "checkConstraints": {},
1443
+ "isRLSEnabled": false
1444
+ },
1445
+ "public.oidc_connections": {
1446
+ "name": "oidc_connections",
1447
+ "schema": "",
1448
+ "columns": {
1449
+ "id": {
1450
+ "name": "id",
1451
+ "type": "uuid",
1452
+ "primaryKey": true,
1453
+ "notNull": true,
1454
+ "default": "gen_random_uuid()"
1455
+ },
1456
+ "org_id": {
1457
+ "name": "org_id",
1458
+ "type": "uuid",
1459
+ "primaryKey": false,
1460
+ "notNull": true
1461
+ },
1462
+ "name": {
1463
+ "name": "name",
1464
+ "type": "text",
1465
+ "primaryKey": false,
1466
+ "notNull": true
1467
+ },
1468
+ "issuer": {
1469
+ "name": "issuer",
1470
+ "type": "text",
1471
+ "primaryKey": false,
1472
+ "notNull": true
1473
+ },
1474
+ "authorization_endpoint": {
1475
+ "name": "authorization_endpoint",
1476
+ "type": "text",
1477
+ "primaryKey": false,
1478
+ "notNull": true
1479
+ },
1480
+ "token_endpoint": {
1481
+ "name": "token_endpoint",
1482
+ "type": "text",
1483
+ "primaryKey": false,
1484
+ "notNull": true
1485
+ },
1486
+ "userinfo_endpoint": {
1487
+ "name": "userinfo_endpoint",
1488
+ "type": "text",
1489
+ "primaryKey": false,
1490
+ "notNull": false
1491
+ },
1492
+ "jwks_uri": {
1493
+ "name": "jwks_uri",
1494
+ "type": "text",
1495
+ "primaryKey": false,
1496
+ "notNull": false
1497
+ },
1498
+ "client_id": {
1499
+ "name": "client_id",
1500
+ "type": "text",
1501
+ "primaryKey": false,
1502
+ "notNull": true
1503
+ },
1504
+ "client_secret": {
1505
+ "name": "client_secret",
1506
+ "type": "text",
1507
+ "primaryKey": false,
1508
+ "notNull": true
1509
+ },
1510
+ "scopes": {
1511
+ "name": "scopes",
1512
+ "type": "text[]",
1513
+ "primaryKey": false,
1514
+ "notNull": true,
1515
+ "default": "'{\"openid\",\"profile\",\"email\"}'::text[]"
1516
+ },
1517
+ "attribute_mapping": {
1518
+ "name": "attribute_mapping",
1519
+ "type": "jsonb",
1520
+ "primaryKey": false,
1521
+ "notNull": true,
1522
+ "default": "'{}'::jsonb"
1523
+ },
1524
+ "is_active": {
1525
+ "name": "is_active",
1526
+ "type": "boolean",
1527
+ "primaryKey": false,
1528
+ "notNull": true,
1529
+ "default": true
1530
+ },
1531
+ "created_at": {
1532
+ "name": "created_at",
1533
+ "type": "timestamp with time zone",
1534
+ "primaryKey": false,
1535
+ "notNull": true,
1536
+ "default": "now()"
1537
+ },
1538
+ "updated_at": {
1539
+ "name": "updated_at",
1540
+ "type": "timestamp with time zone",
1541
+ "primaryKey": false,
1542
+ "notNull": true,
1543
+ "default": "now()"
1544
+ }
1545
+ },
1546
+ "indexes": {
1547
+ "oidc_connections_org_idx": {
1548
+ "name": "oidc_connections_org_idx",
1549
+ "columns": [
1550
+ {
1551
+ "expression": "org_id",
1552
+ "isExpression": false,
1553
+ "asc": true,
1554
+ "nulls": "last"
1555
+ }
1556
+ ],
1557
+ "isUnique": false,
1558
+ "concurrently": false,
1559
+ "method": "btree",
1560
+ "with": {}
1561
+ }
1562
+ },
1563
+ "foreignKeys": {
1564
+ "oidc_connections_org_id_organizations_id_fk": {
1565
+ "name": "oidc_connections_org_id_organizations_id_fk",
1566
+ "tableFrom": "oidc_connections",
1567
+ "tableTo": "organizations",
1568
+ "columnsFrom": [
1569
+ "org_id"
1570
+ ],
1571
+ "columnsTo": [
1572
+ "id"
1573
+ ],
1574
+ "onDelete": "cascade",
1575
+ "onUpdate": "no action"
1576
+ }
1577
+ },
1578
+ "compositePrimaryKeys": {},
1579
+ "uniqueConstraints": {},
1580
+ "policies": {},
1581
+ "checkConstraints": {},
1582
+ "isRLSEnabled": false
1583
+ },
1584
+ "public.org_memberships": {
1585
+ "name": "org_memberships",
1586
+ "schema": "",
1587
+ "columns": {
1588
+ "id": {
1589
+ "name": "id",
1590
+ "type": "uuid",
1591
+ "primaryKey": true,
1592
+ "notNull": true,
1593
+ "default": "gen_random_uuid()"
1594
+ },
1595
+ "org_id": {
1596
+ "name": "org_id",
1597
+ "type": "uuid",
1598
+ "primaryKey": false,
1599
+ "notNull": true
1600
+ },
1601
+ "user_id": {
1602
+ "name": "user_id",
1603
+ "type": "uuid",
1604
+ "primaryKey": false,
1605
+ "notNull": true
1606
+ },
1607
+ "role": {
1608
+ "name": "role",
1609
+ "type": "text",
1610
+ "primaryKey": false,
1611
+ "notNull": true,
1612
+ "default": "'member'"
1613
+ },
1614
+ "created_at": {
1615
+ "name": "created_at",
1616
+ "type": "timestamp with time zone",
1617
+ "primaryKey": false,
1618
+ "notNull": true,
1619
+ "default": "now()"
1620
+ },
1621
+ "updated_at": {
1622
+ "name": "updated_at",
1623
+ "type": "timestamp with time zone",
1624
+ "primaryKey": false,
1625
+ "notNull": true,
1626
+ "default": "now()"
1627
+ }
1628
+ },
1629
+ "indexes": {
1630
+ "org_memberships_org_idx": {
1631
+ "name": "org_memberships_org_idx",
1632
+ "columns": [
1633
+ {
1634
+ "expression": "org_id",
1635
+ "isExpression": false,
1636
+ "asc": true,
1637
+ "nulls": "last"
1638
+ }
1639
+ ],
1640
+ "isUnique": false,
1641
+ "concurrently": false,
1642
+ "method": "btree",
1643
+ "with": {}
1644
+ },
1645
+ "org_memberships_user_idx": {
1646
+ "name": "org_memberships_user_idx",
1647
+ "columns": [
1648
+ {
1649
+ "expression": "user_id",
1650
+ "isExpression": false,
1651
+ "asc": true,
1652
+ "nulls": "last"
1653
+ }
1654
+ ],
1655
+ "isUnique": false,
1656
+ "concurrently": false,
1657
+ "method": "btree",
1658
+ "with": {}
1659
+ }
1660
+ },
1661
+ "foreignKeys": {
1662
+ "org_memberships_org_id_organizations_id_fk": {
1663
+ "name": "org_memberships_org_id_organizations_id_fk",
1664
+ "tableFrom": "org_memberships",
1665
+ "tableTo": "organizations",
1666
+ "columnsFrom": [
1667
+ "org_id"
1668
+ ],
1669
+ "columnsTo": [
1670
+ "id"
1671
+ ],
1672
+ "onDelete": "cascade",
1673
+ "onUpdate": "no action"
1674
+ },
1675
+ "org_memberships_user_id_users_id_fk": {
1676
+ "name": "org_memberships_user_id_users_id_fk",
1677
+ "tableFrom": "org_memberships",
1678
+ "tableTo": "users",
1679
+ "columnsFrom": [
1680
+ "user_id"
1681
+ ],
1682
+ "columnsTo": [
1683
+ "id"
1684
+ ],
1685
+ "onDelete": "cascade",
1686
+ "onUpdate": "no action"
1687
+ }
1688
+ },
1689
+ "compositePrimaryKeys": {},
1690
+ "uniqueConstraints": {
1691
+ "org_memberships_unique": {
1692
+ "name": "org_memberships_unique",
1693
+ "nullsNotDistinct": false,
1694
+ "columns": [
1695
+ "org_id",
1696
+ "user_id"
1697
+ ]
1698
+ }
1699
+ },
1700
+ "policies": {},
1701
+ "checkConstraints": {
1702
+ "org_memberships_role_check": {
1703
+ "name": "org_memberships_role_check",
1704
+ "value": "role in ('owner', 'admin', 'member')"
1705
+ }
1706
+ },
1707
+ "isRLSEnabled": false
1708
+ },
1709
+ "public.organizations": {
1710
+ "name": "organizations",
1711
+ "schema": "",
1712
+ "columns": {
1713
+ "id": {
1714
+ "name": "id",
1715
+ "type": "uuid",
1716
+ "primaryKey": true,
1717
+ "notNull": true,
1718
+ "default": "gen_random_uuid()"
1719
+ },
1720
+ "name": {
1721
+ "name": "name",
1722
+ "type": "text",
1723
+ "primaryKey": false,
1724
+ "notNull": true
1725
+ },
1726
+ "slug": {
1727
+ "name": "slug",
1728
+ "type": "text",
1729
+ "primaryKey": false,
1730
+ "notNull": true
1731
+ },
1732
+ "plan": {
1733
+ "name": "plan",
1734
+ "type": "text",
1735
+ "primaryKey": false,
1736
+ "notNull": true,
1737
+ "default": "'free'"
1738
+ },
1739
+ "branding": {
1740
+ "name": "branding",
1741
+ "type": "jsonb",
1742
+ "primaryKey": false,
1743
+ "notNull": true,
1744
+ "default": "'{}'::jsonb"
1745
+ },
1746
+ "created_at": {
1747
+ "name": "created_at",
1748
+ "type": "timestamp with time zone",
1749
+ "primaryKey": false,
1750
+ "notNull": true,
1751
+ "default": "now()"
1752
+ },
1753
+ "updated_at": {
1754
+ "name": "updated_at",
1755
+ "type": "timestamp with time zone",
1756
+ "primaryKey": false,
1757
+ "notNull": true,
1758
+ "default": "now()"
1759
+ }
1760
+ },
1761
+ "indexes": {
1762
+ "organizations_slug_idx": {
1763
+ "name": "organizations_slug_idx",
1764
+ "columns": [
1765
+ {
1766
+ "expression": "slug",
1767
+ "isExpression": false,
1768
+ "asc": true,
1769
+ "nulls": "last"
1770
+ }
1771
+ ],
1772
+ "isUnique": false,
1773
+ "concurrently": false,
1774
+ "method": "btree",
1775
+ "with": {}
1776
+ }
1777
+ },
1778
+ "foreignKeys": {},
1779
+ "compositePrimaryKeys": {},
1780
+ "uniqueConstraints": {
1781
+ "organizations_slug_unique": {
1782
+ "name": "organizations_slug_unique",
1783
+ "nullsNotDistinct": false,
1784
+ "columns": [
1785
+ "slug"
1786
+ ]
1787
+ }
1788
+ },
1789
+ "policies": {},
1790
+ "checkConstraints": {},
1791
+ "isRLSEnabled": false
1792
+ },
1793
+ "public.password_reset_tokens": {
1794
+ "name": "password_reset_tokens",
1795
+ "schema": "",
1796
+ "columns": {
1797
+ "id": {
1798
+ "name": "id",
1799
+ "type": "uuid",
1800
+ "primaryKey": true,
1801
+ "notNull": true,
1802
+ "default": "gen_random_uuid()"
1803
+ },
1804
+ "user_id": {
1805
+ "name": "user_id",
1806
+ "type": "uuid",
1807
+ "primaryKey": false,
1808
+ "notNull": true
1809
+ },
1810
+ "token_hash": {
1811
+ "name": "token_hash",
1812
+ "type": "text",
1813
+ "primaryKey": false,
1814
+ "notNull": true
1815
+ },
1816
+ "used_at": {
1817
+ "name": "used_at",
1818
+ "type": "timestamp with time zone",
1819
+ "primaryKey": false,
1820
+ "notNull": false
1821
+ },
1822
+ "expires_at": {
1823
+ "name": "expires_at",
1824
+ "type": "timestamp with time zone",
1825
+ "primaryKey": false,
1826
+ "notNull": true
1827
+ },
1828
+ "created_at": {
1829
+ "name": "created_at",
1830
+ "type": "timestamp with time zone",
1831
+ "primaryKey": false,
1832
+ "notNull": true,
1833
+ "default": "now()"
1834
+ }
1835
+ },
1836
+ "indexes": {
1837
+ "password_reset_tokens_user_idx": {
1838
+ "name": "password_reset_tokens_user_idx",
1839
+ "columns": [
1840
+ {
1841
+ "expression": "user_id",
1842
+ "isExpression": false,
1843
+ "asc": true,
1844
+ "nulls": "last"
1845
+ }
1846
+ ],
1847
+ "isUnique": false,
1848
+ "concurrently": false,
1849
+ "method": "btree",
1850
+ "with": {}
1851
+ },
1852
+ "password_reset_tokens_hash_idx": {
1853
+ "name": "password_reset_tokens_hash_idx",
1854
+ "columns": [
1855
+ {
1856
+ "expression": "token_hash",
1857
+ "isExpression": false,
1858
+ "asc": true,
1859
+ "nulls": "last"
1860
+ }
1861
+ ],
1862
+ "isUnique": false,
1863
+ "concurrently": false,
1864
+ "method": "btree",
1865
+ "with": {}
1866
+ }
1867
+ },
1868
+ "foreignKeys": {
1869
+ "password_reset_tokens_user_id_users_id_fk": {
1870
+ "name": "password_reset_tokens_user_id_users_id_fk",
1871
+ "tableFrom": "password_reset_tokens",
1872
+ "tableTo": "users",
1873
+ "columnsFrom": [
1874
+ "user_id"
1875
+ ],
1876
+ "columnsTo": [
1877
+ "id"
1878
+ ],
1879
+ "onDelete": "cascade",
1880
+ "onUpdate": "no action"
1881
+ }
1882
+ },
1883
+ "compositePrimaryKeys": {},
1884
+ "uniqueConstraints": {},
1885
+ "policies": {},
1886
+ "checkConstraints": {},
1887
+ "isRLSEnabled": false
1888
+ },
1889
+ "public.permissions": {
1890
+ "name": "permissions",
1891
+ "schema": "",
1892
+ "columns": {
1893
+ "id": {
1894
+ "name": "id",
1895
+ "type": "uuid",
1896
+ "primaryKey": true,
1897
+ "notNull": true,
1898
+ "default": "gen_random_uuid()"
1899
+ },
1900
+ "resource": {
1901
+ "name": "resource",
1902
+ "type": "text",
1903
+ "primaryKey": false,
1904
+ "notNull": true
1905
+ },
1906
+ "action": {
1907
+ "name": "action",
1908
+ "type": "text",
1909
+ "primaryKey": false,
1910
+ "notNull": true
1911
+ },
1912
+ "description": {
1913
+ "name": "description",
1914
+ "type": "text",
1915
+ "primaryKey": false,
1916
+ "notNull": false
1917
+ },
1918
+ "created_at": {
1919
+ "name": "created_at",
1920
+ "type": "timestamp with time zone",
1921
+ "primaryKey": false,
1922
+ "notNull": true,
1923
+ "default": "now()"
1924
+ }
1925
+ },
1926
+ "indexes": {},
1927
+ "foreignKeys": {},
1928
+ "compositePrimaryKeys": {},
1929
+ "uniqueConstraints": {
1930
+ "permissions_resource_action_idx": {
1931
+ "name": "permissions_resource_action_idx",
1932
+ "nullsNotDistinct": false,
1933
+ "columns": [
1934
+ "resource",
1935
+ "action"
1936
+ ]
1937
+ }
1938
+ },
1939
+ "policies": {},
1940
+ "checkConstraints": {},
1941
+ "isRLSEnabled": false
1942
+ },
1943
+ "public.refresh_tokens": {
1944
+ "name": "refresh_tokens",
1945
+ "schema": "",
1946
+ "columns": {
1947
+ "id": {
1948
+ "name": "id",
1949
+ "type": "uuid",
1950
+ "primaryKey": true,
1951
+ "notNull": true,
1952
+ "default": "gen_random_uuid()"
1953
+ },
1954
+ "user_id": {
1955
+ "name": "user_id",
1956
+ "type": "uuid",
1957
+ "primaryKey": false,
1958
+ "notNull": true
1959
+ },
1960
+ "app_id": {
1961
+ "name": "app_id",
1962
+ "type": "uuid",
1963
+ "primaryKey": false,
1964
+ "notNull": false
1965
+ },
1966
+ "token_hash": {
1967
+ "name": "token_hash",
1968
+ "type": "text",
1969
+ "primaryKey": false,
1970
+ "notNull": true
1971
+ },
1972
+ "expires_at": {
1973
+ "name": "expires_at",
1974
+ "type": "timestamp with time zone",
1975
+ "primaryKey": false,
1976
+ "notNull": true
1977
+ },
1978
+ "revoked_at": {
1979
+ "name": "revoked_at",
1980
+ "type": "timestamp with time zone",
1981
+ "primaryKey": false,
1982
+ "notNull": false
1983
+ },
1984
+ "created_at": {
1985
+ "name": "created_at",
1986
+ "type": "timestamp with time zone",
1987
+ "primaryKey": false,
1988
+ "notNull": true,
1989
+ "default": "now()"
1990
+ },
1991
+ "ip_address": {
1992
+ "name": "ip_address",
1993
+ "type": "text",
1994
+ "primaryKey": false,
1995
+ "notNull": false
1996
+ },
1997
+ "user_agent": {
1998
+ "name": "user_agent",
1999
+ "type": "text",
2000
+ "primaryKey": false,
2001
+ "notNull": false
2002
+ },
2003
+ "device_fingerprint": {
2004
+ "name": "device_fingerprint",
2005
+ "type": "text",
2006
+ "primaryKey": false,
2007
+ "notNull": false
2008
+ },
2009
+ "mfa_factor": {
2010
+ "name": "mfa_factor",
2011
+ "type": "text",
2012
+ "primaryKey": false,
2013
+ "notNull": false
2014
+ }
2015
+ },
2016
+ "indexes": {
2017
+ "refresh_tokens_user_idx": {
2018
+ "name": "refresh_tokens_user_idx",
2019
+ "columns": [
2020
+ {
2021
+ "expression": "user_id",
2022
+ "isExpression": false,
2023
+ "asc": true,
2024
+ "nulls": "last"
2025
+ }
2026
+ ],
2027
+ "isUnique": false,
2028
+ "concurrently": false,
2029
+ "method": "btree",
2030
+ "with": {}
2031
+ },
2032
+ "refresh_tokens_app_idx": {
2033
+ "name": "refresh_tokens_app_idx",
2034
+ "columns": [
2035
+ {
2036
+ "expression": "app_id",
2037
+ "isExpression": false,
2038
+ "asc": true,
2039
+ "nulls": "last"
2040
+ }
2041
+ ],
2042
+ "isUnique": false,
2043
+ "concurrently": false,
2044
+ "method": "btree",
2045
+ "with": {}
2046
+ },
2047
+ "refresh_tokens_hash_idx": {
2048
+ "name": "refresh_tokens_hash_idx",
2049
+ "columns": [
2050
+ {
2051
+ "expression": "token_hash",
2052
+ "isExpression": false,
2053
+ "asc": true,
2054
+ "nulls": "last"
2055
+ }
2056
+ ],
2057
+ "isUnique": false,
2058
+ "concurrently": false,
2059
+ "method": "btree",
2060
+ "with": {}
2061
+ }
2062
+ },
2063
+ "foreignKeys": {
2064
+ "refresh_tokens_user_id_users_id_fk": {
2065
+ "name": "refresh_tokens_user_id_users_id_fk",
2066
+ "tableFrom": "refresh_tokens",
2067
+ "tableTo": "users",
2068
+ "columnsFrom": [
2069
+ "user_id"
2070
+ ],
2071
+ "columnsTo": [
2072
+ "id"
2073
+ ],
2074
+ "onDelete": "cascade",
2075
+ "onUpdate": "no action"
2076
+ },
2077
+ "refresh_tokens_app_id_applications_id_fk": {
2078
+ "name": "refresh_tokens_app_id_applications_id_fk",
2079
+ "tableFrom": "refresh_tokens",
2080
+ "tableTo": "applications",
2081
+ "columnsFrom": [
2082
+ "app_id"
2083
+ ],
2084
+ "columnsTo": [
2085
+ "id"
2086
+ ],
2087
+ "onDelete": "restrict",
2088
+ "onUpdate": "no action"
2089
+ }
2090
+ },
2091
+ "compositePrimaryKeys": {},
2092
+ "uniqueConstraints": {},
2093
+ "policies": {},
2094
+ "checkConstraints": {
2095
+ "refresh_tokens_mfa_factor_check": {
2096
+ "name": "refresh_tokens_mfa_factor_check",
2097
+ "value": "mfa_factor is null or mfa_factor in ('totp', 'backup_code', 'webauthn', 'session')"
2098
+ }
2099
+ },
2100
+ "isRLSEnabled": false
2101
+ },
2102
+ "public.role_permissions": {
2103
+ "name": "role_permissions",
2104
+ "schema": "",
2105
+ "columns": {
2106
+ "id": {
2107
+ "name": "id",
2108
+ "type": "uuid",
2109
+ "primaryKey": true,
2110
+ "notNull": true,
2111
+ "default": "gen_random_uuid()"
2112
+ },
2113
+ "role": {
2114
+ "name": "role",
2115
+ "type": "text",
2116
+ "primaryKey": false,
2117
+ "notNull": true
2118
+ },
2119
+ "permission_id": {
2120
+ "name": "permission_id",
2121
+ "type": "uuid",
2122
+ "primaryKey": false,
2123
+ "notNull": true
2124
+ },
2125
+ "created_at": {
2126
+ "name": "created_at",
2127
+ "type": "timestamp with time zone",
2128
+ "primaryKey": false,
2129
+ "notNull": true,
2130
+ "default": "now()"
2131
+ }
2132
+ },
2133
+ "indexes": {},
2134
+ "foreignKeys": {
2135
+ "role_permissions_permission_id_permissions_id_fk": {
2136
+ "name": "role_permissions_permission_id_permissions_id_fk",
2137
+ "tableFrom": "role_permissions",
2138
+ "tableTo": "permissions",
2139
+ "columnsFrom": [
2140
+ "permission_id"
2141
+ ],
2142
+ "columnsTo": [
2143
+ "id"
2144
+ ],
2145
+ "onDelete": "cascade",
2146
+ "onUpdate": "no action"
2147
+ }
2148
+ },
2149
+ "compositePrimaryKeys": {},
2150
+ "uniqueConstraints": {
2151
+ "role_permissions_idx": {
2152
+ "name": "role_permissions_idx",
2153
+ "nullsNotDistinct": false,
2154
+ "columns": [
2155
+ "role",
2156
+ "permission_id"
2157
+ ]
2158
+ }
2159
+ },
2160
+ "policies": {},
2161
+ "checkConstraints": {},
2162
+ "isRLSEnabled": false
2163
+ },
2164
+ "public.saml_connections": {
2165
+ "name": "saml_connections",
2166
+ "schema": "",
2167
+ "columns": {
2168
+ "id": {
2169
+ "name": "id",
2170
+ "type": "uuid",
2171
+ "primaryKey": true,
2172
+ "notNull": true,
2173
+ "default": "gen_random_uuid()"
2174
+ },
2175
+ "org_id": {
2176
+ "name": "org_id",
2177
+ "type": "uuid",
2178
+ "primaryKey": false,
2179
+ "notNull": true
2180
+ },
2181
+ "name": {
2182
+ "name": "name",
2183
+ "type": "text",
2184
+ "primaryKey": false,
2185
+ "notNull": true
2186
+ },
2187
+ "idp_entity_id": {
2188
+ "name": "idp_entity_id",
2189
+ "type": "text",
2190
+ "primaryKey": false,
2191
+ "notNull": false
2192
+ },
2193
+ "idp_sso_url": {
2194
+ "name": "idp_sso_url",
2195
+ "type": "text",
2196
+ "primaryKey": false,
2197
+ "notNull": false
2198
+ },
2199
+ "idp_certificate": {
2200
+ "name": "idp_certificate",
2201
+ "type": "text",
2202
+ "primaryKey": false,
2203
+ "notNull": false
2204
+ },
2205
+ "sp_entity_id": {
2206
+ "name": "sp_entity_id",
2207
+ "type": "text",
2208
+ "primaryKey": false,
2209
+ "notNull": true
2210
+ },
2211
+ "sp_acs_url": {
2212
+ "name": "sp_acs_url",
2213
+ "type": "text",
2214
+ "primaryKey": false,
2215
+ "notNull": true
2216
+ },
2217
+ "attribute_mapping": {
2218
+ "name": "attribute_mapping",
2219
+ "type": "jsonb",
2220
+ "primaryKey": false,
2221
+ "notNull": true,
2222
+ "default": "'{}'::jsonb"
2223
+ },
2224
+ "is_active": {
2225
+ "name": "is_active",
2226
+ "type": "boolean",
2227
+ "primaryKey": false,
2228
+ "notNull": true,
2229
+ "default": true
2230
+ },
2231
+ "created_at": {
2232
+ "name": "created_at",
2233
+ "type": "timestamp with time zone",
2234
+ "primaryKey": false,
2235
+ "notNull": true,
2236
+ "default": "now()"
2237
+ },
2238
+ "updated_at": {
2239
+ "name": "updated_at",
2240
+ "type": "timestamp with time zone",
2241
+ "primaryKey": false,
2242
+ "notNull": true,
2243
+ "default": "now()"
2244
+ }
2245
+ },
2246
+ "indexes": {
2247
+ "saml_connections_org_idx": {
2248
+ "name": "saml_connections_org_idx",
2249
+ "columns": [
2250
+ {
2251
+ "expression": "org_id",
2252
+ "isExpression": false,
2253
+ "asc": true,
2254
+ "nulls": "last"
2255
+ }
2256
+ ],
2257
+ "isUnique": false,
2258
+ "concurrently": false,
2259
+ "method": "btree",
2260
+ "with": {}
2261
+ }
2262
+ },
2263
+ "foreignKeys": {
2264
+ "saml_connections_org_id_organizations_id_fk": {
2265
+ "name": "saml_connections_org_id_organizations_id_fk",
2266
+ "tableFrom": "saml_connections",
2267
+ "tableTo": "organizations",
2268
+ "columnsFrom": [
2269
+ "org_id"
2270
+ ],
2271
+ "columnsTo": [
2272
+ "id"
2273
+ ],
2274
+ "onDelete": "cascade",
2275
+ "onUpdate": "no action"
2276
+ }
2277
+ },
2278
+ "compositePrimaryKeys": {},
2279
+ "uniqueConstraints": {},
2280
+ "policies": {},
2281
+ "checkConstraints": {},
2282
+ "isRLSEnabled": false
2283
+ },
2284
+ "public.scim_connections": {
2285
+ "name": "scim_connections",
2286
+ "schema": "",
2287
+ "columns": {
2288
+ "id": {
2289
+ "name": "id",
2290
+ "type": "uuid",
2291
+ "primaryKey": true,
2292
+ "notNull": true,
2293
+ "default": "gen_random_uuid()"
2294
+ },
2295
+ "org_id": {
2296
+ "name": "org_id",
2297
+ "type": "uuid",
2298
+ "primaryKey": false,
2299
+ "notNull": true
2300
+ },
2301
+ "name": {
2302
+ "name": "name",
2303
+ "type": "text",
2304
+ "primaryKey": false,
2305
+ "notNull": true
2306
+ },
2307
+ "token_hash": {
2308
+ "name": "token_hash",
2309
+ "type": "text",
2310
+ "primaryKey": false,
2311
+ "notNull": true
2312
+ },
2313
+ "token_hint": {
2314
+ "name": "token_hint",
2315
+ "type": "text",
2316
+ "primaryKey": false,
2317
+ "notNull": true
2318
+ },
2319
+ "previous_token_hash": {
2320
+ "name": "previous_token_hash",
2321
+ "type": "text",
2322
+ "primaryKey": false,
2323
+ "notNull": false
2324
+ },
2325
+ "previous_token_valid_until": {
2326
+ "name": "previous_token_valid_until",
2327
+ "type": "timestamp with time zone",
2328
+ "primaryKey": false,
2329
+ "notNull": false
2330
+ },
2331
+ "created_by_user_id": {
2332
+ "name": "created_by_user_id",
2333
+ "type": "uuid",
2334
+ "primaryKey": false,
2335
+ "notNull": false
2336
+ },
2337
+ "expires_at": {
2338
+ "name": "expires_at",
2339
+ "type": "timestamp with time zone",
2340
+ "primaryKey": false,
2341
+ "notNull": false
2342
+ },
2343
+ "revoked_at": {
2344
+ "name": "revoked_at",
2345
+ "type": "timestamp with time zone",
2346
+ "primaryKey": false,
2347
+ "notNull": false
2348
+ },
2349
+ "last_rotated_at": {
2350
+ "name": "last_rotated_at",
2351
+ "type": "timestamp with time zone",
2352
+ "primaryKey": false,
2353
+ "notNull": false
2354
+ },
2355
+ "last_used_at": {
2356
+ "name": "last_used_at",
2357
+ "type": "timestamp with time zone",
2358
+ "primaryKey": false,
2359
+ "notNull": false
2360
+ },
2361
+ "created_at": {
2362
+ "name": "created_at",
2363
+ "type": "timestamp with time zone",
2364
+ "primaryKey": false,
2365
+ "notNull": true,
2366
+ "default": "now()"
2367
+ },
2368
+ "updated_at": {
2369
+ "name": "updated_at",
2370
+ "type": "timestamp with time zone",
2371
+ "primaryKey": false,
2372
+ "notNull": true,
2373
+ "default": "now()"
2374
+ }
2375
+ },
2376
+ "indexes": {
2377
+ "scim_connections_org_idx": {
2378
+ "name": "scim_connections_org_idx",
2379
+ "columns": [
2380
+ {
2381
+ "expression": "org_id",
2382
+ "isExpression": false,
2383
+ "asc": true,
2384
+ "nulls": "last"
2385
+ }
2386
+ ],
2387
+ "isUnique": false,
2388
+ "concurrently": false,
2389
+ "method": "btree",
2390
+ "with": {}
2391
+ },
2392
+ "scim_connections_token_hash_unique": {
2393
+ "name": "scim_connections_token_hash_unique",
2394
+ "columns": [
2395
+ {
2396
+ "expression": "token_hash",
2397
+ "isExpression": false,
2398
+ "asc": true,
2399
+ "nulls": "last"
2400
+ }
2401
+ ],
2402
+ "isUnique": true,
2403
+ "concurrently": false,
2404
+ "method": "btree",
2405
+ "with": {}
2406
+ },
2407
+ "scim_connections_previous_token_hash_unique": {
2408
+ "name": "scim_connections_previous_token_hash_unique",
2409
+ "columns": [
2410
+ {
2411
+ "expression": "previous_token_hash",
2412
+ "isExpression": false,
2413
+ "asc": true,
2414
+ "nulls": "last"
2415
+ }
2416
+ ],
2417
+ "isUnique": true,
2418
+ "where": "previous_token_hash is not null",
2419
+ "concurrently": false,
2420
+ "method": "btree",
2421
+ "with": {}
2422
+ },
2423
+ "scim_connections_active_org_unique": {
2424
+ "name": "scim_connections_active_org_unique",
2425
+ "columns": [
2426
+ {
2427
+ "expression": "org_id",
2428
+ "isExpression": false,
2429
+ "asc": true,
2430
+ "nulls": "last"
2431
+ }
2432
+ ],
2433
+ "isUnique": true,
2434
+ "where": "revoked_at is null",
2435
+ "concurrently": false,
2436
+ "method": "btree",
2437
+ "with": {}
2438
+ }
2439
+ },
2440
+ "foreignKeys": {
2441
+ "scim_connections_org_id_organizations_id_fk": {
2442
+ "name": "scim_connections_org_id_organizations_id_fk",
2443
+ "tableFrom": "scim_connections",
2444
+ "tableTo": "organizations",
2445
+ "columnsFrom": [
2446
+ "org_id"
2447
+ ],
2448
+ "columnsTo": [
2449
+ "id"
2450
+ ],
2451
+ "onDelete": "cascade",
2452
+ "onUpdate": "no action"
2453
+ },
2454
+ "scim_connections_created_by_user_id_users_id_fk": {
2455
+ "name": "scim_connections_created_by_user_id_users_id_fk",
2456
+ "tableFrom": "scim_connections",
2457
+ "tableTo": "users",
2458
+ "columnsFrom": [
2459
+ "created_by_user_id"
2460
+ ],
2461
+ "columnsTo": [
2462
+ "id"
2463
+ ],
2464
+ "onDelete": "set null",
2465
+ "onUpdate": "no action"
2466
+ }
2467
+ },
2468
+ "compositePrimaryKeys": {},
2469
+ "uniqueConstraints": {},
2470
+ "policies": {},
2471
+ "checkConstraints": {},
2472
+ "isRLSEnabled": false
2473
+ },
2474
+ "public.scim_group_members": {
2475
+ "name": "scim_group_members",
2476
+ "schema": "",
2477
+ "columns": {
2478
+ "id": {
2479
+ "name": "id",
2480
+ "type": "uuid",
2481
+ "primaryKey": true,
2482
+ "notNull": true,
2483
+ "default": "gen_random_uuid()"
2484
+ },
2485
+ "group_id": {
2486
+ "name": "group_id",
2487
+ "type": "uuid",
2488
+ "primaryKey": false,
2489
+ "notNull": true
2490
+ },
2491
+ "user_id": {
2492
+ "name": "user_id",
2493
+ "type": "uuid",
2494
+ "primaryKey": false,
2495
+ "notNull": true
2496
+ },
2497
+ "created_at": {
2498
+ "name": "created_at",
2499
+ "type": "timestamp with time zone",
2500
+ "primaryKey": false,
2501
+ "notNull": true,
2502
+ "default": "now()"
2503
+ }
2504
+ },
2505
+ "indexes": {
2506
+ "scim_group_members_group_idx": {
2507
+ "name": "scim_group_members_group_idx",
2508
+ "columns": [
2509
+ {
2510
+ "expression": "group_id",
2511
+ "isExpression": false,
2512
+ "asc": true,
2513
+ "nulls": "last"
2514
+ }
2515
+ ],
2516
+ "isUnique": false,
2517
+ "concurrently": false,
2518
+ "method": "btree",
2519
+ "with": {}
2520
+ },
2521
+ "scim_group_members_user_idx": {
2522
+ "name": "scim_group_members_user_idx",
2523
+ "columns": [
2524
+ {
2525
+ "expression": "user_id",
2526
+ "isExpression": false,
2527
+ "asc": true,
2528
+ "nulls": "last"
2529
+ }
2530
+ ],
2531
+ "isUnique": false,
2532
+ "concurrently": false,
2533
+ "method": "btree",
2534
+ "with": {}
2535
+ }
2536
+ },
2537
+ "foreignKeys": {
2538
+ "scim_group_members_group_id_scim_groups_id_fk": {
2539
+ "name": "scim_group_members_group_id_scim_groups_id_fk",
2540
+ "tableFrom": "scim_group_members",
2541
+ "tableTo": "scim_groups",
2542
+ "columnsFrom": [
2543
+ "group_id"
2544
+ ],
2545
+ "columnsTo": [
2546
+ "id"
2547
+ ],
2548
+ "onDelete": "cascade",
2549
+ "onUpdate": "no action"
2550
+ },
2551
+ "scim_group_members_user_id_users_id_fk": {
2552
+ "name": "scim_group_members_user_id_users_id_fk",
2553
+ "tableFrom": "scim_group_members",
2554
+ "tableTo": "users",
2555
+ "columnsFrom": [
2556
+ "user_id"
2557
+ ],
2558
+ "columnsTo": [
2559
+ "id"
2560
+ ],
2561
+ "onDelete": "cascade",
2562
+ "onUpdate": "no action"
2563
+ }
2564
+ },
2565
+ "compositePrimaryKeys": {},
2566
+ "uniqueConstraints": {
2567
+ "scim_group_members_group_user_unique": {
2568
+ "name": "scim_group_members_group_user_unique",
2569
+ "nullsNotDistinct": false,
2570
+ "columns": [
2571
+ "group_id",
2572
+ "user_id"
2573
+ ]
2574
+ }
2575
+ },
2576
+ "policies": {},
2577
+ "checkConstraints": {},
2578
+ "isRLSEnabled": false
2579
+ },
2580
+ "public.scim_groups": {
2581
+ "name": "scim_groups",
2582
+ "schema": "",
2583
+ "columns": {
2584
+ "id": {
2585
+ "name": "id",
2586
+ "type": "uuid",
2587
+ "primaryKey": true,
2588
+ "notNull": true,
2589
+ "default": "gen_random_uuid()"
2590
+ },
2591
+ "org_id": {
2592
+ "name": "org_id",
2593
+ "type": "uuid",
2594
+ "primaryKey": false,
2595
+ "notNull": true
2596
+ },
2597
+ "display_name": {
2598
+ "name": "display_name",
2599
+ "type": "text",
2600
+ "primaryKey": false,
2601
+ "notNull": true
2602
+ },
2603
+ "description": {
2604
+ "name": "description",
2605
+ "type": "text",
2606
+ "primaryKey": false,
2607
+ "notNull": false
2608
+ },
2609
+ "external_id": {
2610
+ "name": "external_id",
2611
+ "type": "text",
2612
+ "primaryKey": false,
2613
+ "notNull": false
2614
+ },
2615
+ "created_at": {
2616
+ "name": "created_at",
2617
+ "type": "timestamp with time zone",
2618
+ "primaryKey": false,
2619
+ "notNull": true,
2620
+ "default": "now()"
2621
+ },
2622
+ "updated_at": {
2623
+ "name": "updated_at",
2624
+ "type": "timestamp with time zone",
2625
+ "primaryKey": false,
2626
+ "notNull": true,
2627
+ "default": "now()"
2628
+ }
2629
+ },
2630
+ "indexes": {
2631
+ "scim_groups_org_idx": {
2632
+ "name": "scim_groups_org_idx",
2633
+ "columns": [
2634
+ {
2635
+ "expression": "org_id",
2636
+ "isExpression": false,
2637
+ "asc": true,
2638
+ "nulls": "last"
2639
+ }
2640
+ ],
2641
+ "isUnique": false,
2642
+ "concurrently": false,
2643
+ "method": "btree",
2644
+ "with": {}
2645
+ }
2646
+ },
2647
+ "foreignKeys": {
2648
+ "scim_groups_org_id_organizations_id_fk": {
2649
+ "name": "scim_groups_org_id_organizations_id_fk",
2650
+ "tableFrom": "scim_groups",
2651
+ "tableTo": "organizations",
2652
+ "columnsFrom": [
2653
+ "org_id"
2654
+ ],
2655
+ "columnsTo": [
2656
+ "id"
2657
+ ],
2658
+ "onDelete": "cascade",
2659
+ "onUpdate": "no action"
2660
+ }
2661
+ },
2662
+ "compositePrimaryKeys": {},
2663
+ "uniqueConstraints": {
2664
+ "scim_groups_org_name_unique": {
2665
+ "name": "scim_groups_org_name_unique",
2666
+ "nullsNotDistinct": false,
2667
+ "columns": [
2668
+ "org_id",
2669
+ "display_name"
2670
+ ]
2671
+ }
2672
+ },
2673
+ "policies": {},
2674
+ "checkConstraints": {},
2675
+ "isRLSEnabled": false
2676
+ },
2677
+ "public.secrets": {
2678
+ "name": "secrets",
2679
+ "schema": "",
2680
+ "columns": {
2681
+ "id": {
2682
+ "name": "id",
2683
+ "type": "uuid",
2684
+ "primaryKey": true,
2685
+ "notNull": true,
2686
+ "default": "gen_random_uuid()"
2687
+ },
2688
+ "key_id": {
2689
+ "name": "key_id",
2690
+ "type": "text",
2691
+ "primaryKey": false,
2692
+ "notNull": true
2693
+ },
2694
+ "type": {
2695
+ "name": "type",
2696
+ "type": "text",
2697
+ "primaryKey": false,
2698
+ "notNull": true
2699
+ },
2700
+ "value": {
2701
+ "name": "value",
2702
+ "type": "text",
2703
+ "primaryKey": false,
2704
+ "notNull": true
2705
+ },
2706
+ "algorithm": {
2707
+ "name": "algorithm",
2708
+ "type": "text",
2709
+ "primaryKey": false,
2710
+ "notNull": false
2711
+ },
2712
+ "is_active": {
2713
+ "name": "is_active",
2714
+ "type": "boolean",
2715
+ "primaryKey": false,
2716
+ "notNull": true,
2717
+ "default": true
2718
+ },
2719
+ "rotated_at": {
2720
+ "name": "rotated_at",
2721
+ "type": "timestamp with time zone",
2722
+ "primaryKey": false,
2723
+ "notNull": false
2724
+ },
2725
+ "expires_at": {
2726
+ "name": "expires_at",
2727
+ "type": "timestamp with time zone",
2728
+ "primaryKey": false,
2729
+ "notNull": false
2730
+ },
2731
+ "created_at": {
2732
+ "name": "created_at",
2733
+ "type": "timestamp with time zone",
2734
+ "primaryKey": false,
2735
+ "notNull": true,
2736
+ "default": "now()"
2737
+ }
2738
+ },
2739
+ "indexes": {
2740
+ "secrets_type_active_idx": {
2741
+ "name": "secrets_type_active_idx",
2742
+ "columns": [
2743
+ {
2744
+ "expression": "type",
2745
+ "isExpression": false,
2746
+ "asc": true,
2747
+ "nulls": "last"
2748
+ },
2749
+ {
2750
+ "expression": "is_active",
2751
+ "isExpression": false,
2752
+ "asc": true,
2753
+ "nulls": "last"
2754
+ }
2755
+ ],
2756
+ "isUnique": false,
2757
+ "concurrently": false,
2758
+ "method": "btree",
2759
+ "with": {}
2760
+ }
2761
+ },
2762
+ "foreignKeys": {},
2763
+ "compositePrimaryKeys": {},
2764
+ "uniqueConstraints": {
2765
+ "secrets_key_id_unique": {
2766
+ "name": "secrets_key_id_unique",
2767
+ "nullsNotDistinct": false,
2768
+ "columns": [
2769
+ "key_id"
2770
+ ]
2771
+ }
2772
+ },
2773
+ "policies": {},
2774
+ "checkConstraints": {},
2775
+ "isRLSEnabled": false
2776
+ },
2777
+ "public.service_accounts": {
2778
+ "name": "service_accounts",
2779
+ "schema": "",
2780
+ "columns": {
2781
+ "id": {
2782
+ "name": "id",
2783
+ "type": "uuid",
2784
+ "primaryKey": true,
2785
+ "notNull": true,
2786
+ "default": "gen_random_uuid()"
2787
+ },
2788
+ "org_id": {
2789
+ "name": "org_id",
2790
+ "type": "uuid",
2791
+ "primaryKey": false,
2792
+ "notNull": true
2793
+ },
2794
+ "name": {
2795
+ "name": "name",
2796
+ "type": "text",
2797
+ "primaryKey": false,
2798
+ "notNull": true
2799
+ },
2800
+ "description": {
2801
+ "name": "description",
2802
+ "type": "text",
2803
+ "primaryKey": false,
2804
+ "notNull": false
2805
+ },
2806
+ "cert_fingerprint": {
2807
+ "name": "cert_fingerprint",
2808
+ "type": "text",
2809
+ "primaryKey": false,
2810
+ "notNull": false
2811
+ },
2812
+ "is_active": {
2813
+ "name": "is_active",
2814
+ "type": "boolean",
2815
+ "primaryKey": false,
2816
+ "notNull": true,
2817
+ "default": true
2818
+ },
2819
+ "revoked_at": {
2820
+ "name": "revoked_at",
2821
+ "type": "timestamp with time zone",
2822
+ "primaryKey": false,
2823
+ "notNull": false
2824
+ },
2825
+ "created_at": {
2826
+ "name": "created_at",
2827
+ "type": "timestamp with time zone",
2828
+ "primaryKey": false,
2829
+ "notNull": true,
2830
+ "default": "now()"
2831
+ },
2832
+ "updated_at": {
2833
+ "name": "updated_at",
2834
+ "type": "timestamp with time zone",
2835
+ "primaryKey": false,
2836
+ "notNull": true,
2837
+ "default": "now()"
2838
+ }
2839
+ },
2840
+ "indexes": {
2841
+ "service_accounts_org_idx": {
2842
+ "name": "service_accounts_org_idx",
2843
+ "columns": [
2844
+ {
2845
+ "expression": "org_id",
2846
+ "isExpression": false,
2847
+ "asc": true,
2848
+ "nulls": "last"
2849
+ }
2850
+ ],
2851
+ "isUnique": false,
2852
+ "concurrently": false,
2853
+ "method": "btree",
2854
+ "with": {}
2855
+ },
2856
+ "service_accounts_cert_fingerprint_unique": {
2857
+ "name": "service_accounts_cert_fingerprint_unique",
2858
+ "columns": [
2859
+ {
2860
+ "expression": "cert_fingerprint",
2861
+ "isExpression": false,
2862
+ "asc": true,
2863
+ "nulls": "last"
2864
+ }
2865
+ ],
2866
+ "isUnique": true,
2867
+ "where": "cert_fingerprint is not null",
2868
+ "concurrently": false,
2869
+ "method": "btree",
2870
+ "with": {}
2871
+ }
2872
+ },
2873
+ "foreignKeys": {
2874
+ "service_accounts_org_id_organizations_id_fk": {
2875
+ "name": "service_accounts_org_id_organizations_id_fk",
2876
+ "tableFrom": "service_accounts",
2877
+ "tableTo": "organizations",
2878
+ "columnsFrom": [
2879
+ "org_id"
2880
+ ],
2881
+ "columnsTo": [
2882
+ "id"
2883
+ ],
2884
+ "onDelete": "cascade",
2885
+ "onUpdate": "no action"
2886
+ }
2887
+ },
2888
+ "compositePrimaryKeys": {},
2889
+ "uniqueConstraints": {},
2890
+ "policies": {},
2891
+ "checkConstraints": {},
2892
+ "isRLSEnabled": false
2893
+ },
2894
+ "public.sms_otp_codes": {
2895
+ "name": "sms_otp_codes",
2896
+ "schema": "",
2897
+ "columns": {
2898
+ "id": {
2899
+ "name": "id",
2900
+ "type": "uuid",
2901
+ "primaryKey": true,
2902
+ "notNull": true,
2903
+ "default": "gen_random_uuid()"
2904
+ },
2905
+ "user_id": {
2906
+ "name": "user_id",
2907
+ "type": "uuid",
2908
+ "primaryKey": false,
2909
+ "notNull": true
2910
+ },
2911
+ "phone_number": {
2912
+ "name": "phone_number",
2913
+ "type": "text",
2914
+ "primaryKey": false,
2915
+ "notNull": true
2916
+ },
2917
+ "code_hash": {
2918
+ "name": "code_hash",
2919
+ "type": "text",
2920
+ "primaryKey": false,
2921
+ "notNull": true
2922
+ },
2923
+ "used_at": {
2924
+ "name": "used_at",
2925
+ "type": "timestamp with time zone",
2926
+ "primaryKey": false,
2927
+ "notNull": false
2928
+ },
2929
+ "expires_at": {
2930
+ "name": "expires_at",
2931
+ "type": "timestamp with time zone",
2932
+ "primaryKey": false,
2933
+ "notNull": true
2934
+ },
2935
+ "created_at": {
2936
+ "name": "created_at",
2937
+ "type": "timestamp with time zone",
2938
+ "primaryKey": false,
2939
+ "notNull": true,
2940
+ "default": "now()"
2941
+ }
2942
+ },
2943
+ "indexes": {
2944
+ "sms_otp_codes_user_idx": {
2945
+ "name": "sms_otp_codes_user_idx",
2946
+ "columns": [
2947
+ {
2948
+ "expression": "user_id",
2949
+ "isExpression": false,
2950
+ "asc": true,
2951
+ "nulls": "last"
2952
+ }
2953
+ ],
2954
+ "isUnique": false,
2955
+ "concurrently": false,
2956
+ "method": "btree",
2957
+ "with": {}
2958
+ }
2959
+ },
2960
+ "foreignKeys": {
2961
+ "sms_otp_codes_user_id_users_id_fk": {
2962
+ "name": "sms_otp_codes_user_id_users_id_fk",
2963
+ "tableFrom": "sms_otp_codes",
2964
+ "tableTo": "users",
2965
+ "columnsFrom": [
2966
+ "user_id"
2967
+ ],
2968
+ "columnsTo": [
2969
+ "id"
2970
+ ],
2971
+ "onDelete": "cascade",
2972
+ "onUpdate": "no action"
2973
+ }
2974
+ },
2975
+ "compositePrimaryKeys": {},
2976
+ "uniqueConstraints": {},
2977
+ "policies": {},
2978
+ "checkConstraints": {},
2979
+ "isRLSEnabled": false
2980
+ },
2981
+ "public.sso_identity_links": {
2982
+ "name": "sso_identity_links",
2983
+ "schema": "",
2984
+ "columns": {
2985
+ "id": {
2986
+ "name": "id",
2987
+ "type": "uuid",
2988
+ "primaryKey": true,
2989
+ "notNull": true,
2990
+ "default": "gen_random_uuid()"
2991
+ },
2992
+ "connection_type": {
2993
+ "name": "connection_type",
2994
+ "type": "text",
2995
+ "primaryKey": false,
2996
+ "notNull": true
2997
+ },
2998
+ "connection_id": {
2999
+ "name": "connection_id",
3000
+ "type": "uuid",
3001
+ "primaryKey": false,
3002
+ "notNull": true
3003
+ },
3004
+ "org_id": {
3005
+ "name": "org_id",
3006
+ "type": "uuid",
3007
+ "primaryKey": false,
3008
+ "notNull": true
3009
+ },
3010
+ "user_id": {
3011
+ "name": "user_id",
3012
+ "type": "uuid",
3013
+ "primaryKey": false,
3014
+ "notNull": true
3015
+ },
3016
+ "external_sub": {
3017
+ "name": "external_sub",
3018
+ "type": "text",
3019
+ "primaryKey": false,
3020
+ "notNull": true
3021
+ },
3022
+ "created_at": {
3023
+ "name": "created_at",
3024
+ "type": "timestamp with time zone",
3025
+ "primaryKey": false,
3026
+ "notNull": true,
3027
+ "default": "now()"
3028
+ }
3029
+ },
3030
+ "indexes": {
3031
+ "sso_identity_links_user_idx": {
3032
+ "name": "sso_identity_links_user_idx",
3033
+ "columns": [
3034
+ {
3035
+ "expression": "user_id",
3036
+ "isExpression": false,
3037
+ "asc": true,
3038
+ "nulls": "last"
3039
+ }
3040
+ ],
3041
+ "isUnique": false,
3042
+ "concurrently": false,
3043
+ "method": "btree",
3044
+ "with": {}
3045
+ }
3046
+ },
3047
+ "foreignKeys": {
3048
+ "sso_identity_links_org_id_organizations_id_fk": {
3049
+ "name": "sso_identity_links_org_id_organizations_id_fk",
3050
+ "tableFrom": "sso_identity_links",
3051
+ "tableTo": "organizations",
3052
+ "columnsFrom": [
3053
+ "org_id"
3054
+ ],
3055
+ "columnsTo": [
3056
+ "id"
3057
+ ],
3058
+ "onDelete": "cascade",
3059
+ "onUpdate": "no action"
3060
+ },
3061
+ "sso_identity_links_user_id_users_id_fk": {
3062
+ "name": "sso_identity_links_user_id_users_id_fk",
3063
+ "tableFrom": "sso_identity_links",
3064
+ "tableTo": "users",
3065
+ "columnsFrom": [
3066
+ "user_id"
3067
+ ],
3068
+ "columnsTo": [
3069
+ "id"
3070
+ ],
3071
+ "onDelete": "cascade",
3072
+ "onUpdate": "no action"
3073
+ }
3074
+ },
3075
+ "compositePrimaryKeys": {},
3076
+ "uniqueConstraints": {
3077
+ "sso_identity_links_connection_sub_unique": {
3078
+ "name": "sso_identity_links_connection_sub_unique",
3079
+ "nullsNotDistinct": false,
3080
+ "columns": [
3081
+ "connection_type",
3082
+ "connection_id",
3083
+ "external_sub"
3084
+ ]
3085
+ },
3086
+ "sso_identity_links_user_connection_unique": {
3087
+ "name": "sso_identity_links_user_connection_unique",
3088
+ "nullsNotDistinct": false,
3089
+ "columns": [
3090
+ "org_id",
3091
+ "user_id",
3092
+ "connection_type",
3093
+ "connection_id"
3094
+ ]
3095
+ }
3096
+ },
3097
+ "policies": {},
3098
+ "checkConstraints": {},
3099
+ "isRLSEnabled": false
3100
+ },
3101
+ "public.totp_backup_codes": {
3102
+ "name": "totp_backup_codes",
3103
+ "schema": "",
3104
+ "columns": {
3105
+ "id": {
3106
+ "name": "id",
3107
+ "type": "uuid",
3108
+ "primaryKey": true,
3109
+ "notNull": true,
3110
+ "default": "gen_random_uuid()"
3111
+ },
3112
+ "user_id": {
3113
+ "name": "user_id",
3114
+ "type": "uuid",
3115
+ "primaryKey": false,
3116
+ "notNull": true
3117
+ },
3118
+ "code_hash": {
3119
+ "name": "code_hash",
3120
+ "type": "text",
3121
+ "primaryKey": false,
3122
+ "notNull": true
3123
+ },
3124
+ "used_at": {
3125
+ "name": "used_at",
3126
+ "type": "timestamp with time zone",
3127
+ "primaryKey": false,
3128
+ "notNull": false
3129
+ },
3130
+ "expires_at": {
3131
+ "name": "expires_at",
3132
+ "type": "timestamp with time zone",
3133
+ "primaryKey": false,
3134
+ "notNull": true
3135
+ },
3136
+ "created_at": {
3137
+ "name": "created_at",
3138
+ "type": "timestamp with time zone",
3139
+ "primaryKey": false,
3140
+ "notNull": true,
3141
+ "default": "now()"
3142
+ }
3143
+ },
3144
+ "indexes": {
3145
+ "totp_backup_codes_user_idx": {
3146
+ "name": "totp_backup_codes_user_idx",
3147
+ "columns": [
3148
+ {
3149
+ "expression": "user_id",
3150
+ "isExpression": false,
3151
+ "asc": true,
3152
+ "nulls": "last"
3153
+ }
3154
+ ],
3155
+ "isUnique": false,
3156
+ "concurrently": false,
3157
+ "method": "btree",
3158
+ "with": {}
3159
+ }
3160
+ },
3161
+ "foreignKeys": {
3162
+ "totp_backup_codes_user_id_users_id_fk": {
3163
+ "name": "totp_backup_codes_user_id_users_id_fk",
3164
+ "tableFrom": "totp_backup_codes",
3165
+ "tableTo": "users",
3166
+ "columnsFrom": [
3167
+ "user_id"
3168
+ ],
3169
+ "columnsTo": [
3170
+ "id"
3171
+ ],
3172
+ "onDelete": "cascade",
3173
+ "onUpdate": "no action"
3174
+ }
3175
+ },
3176
+ "compositePrimaryKeys": {},
3177
+ "uniqueConstraints": {
3178
+ "totp_backup_codes_user_code_unique": {
3179
+ "name": "totp_backup_codes_user_code_unique",
3180
+ "nullsNotDistinct": false,
3181
+ "columns": [
3182
+ "user_id",
3183
+ "code_hash"
3184
+ ]
3185
+ }
3186
+ },
3187
+ "policies": {},
3188
+ "checkConstraints": {},
3189
+ "isRLSEnabled": false
3190
+ },
3191
+ "public.user_devices": {
3192
+ "name": "user_devices",
3193
+ "schema": "",
3194
+ "columns": {
3195
+ "id": {
3196
+ "name": "id",
3197
+ "type": "uuid",
3198
+ "primaryKey": true,
3199
+ "notNull": true,
3200
+ "default": "gen_random_uuid()"
3201
+ },
3202
+ "user_id": {
3203
+ "name": "user_id",
3204
+ "type": "uuid",
3205
+ "primaryKey": false,
3206
+ "notNull": true
3207
+ },
3208
+ "fingerprint_hash": {
3209
+ "name": "fingerprint_hash",
3210
+ "type": "text",
3211
+ "primaryKey": false,
3212
+ "notNull": true
3213
+ },
3214
+ "ip_address": {
3215
+ "name": "ip_address",
3216
+ "type": "text",
3217
+ "primaryKey": false,
3218
+ "notNull": false
3219
+ },
3220
+ "user_agent": {
3221
+ "name": "user_agent",
3222
+ "type": "text",
3223
+ "primaryKey": false,
3224
+ "notNull": false
3225
+ },
3226
+ "first_seen_at": {
3227
+ "name": "first_seen_at",
3228
+ "type": "timestamp with time zone",
3229
+ "primaryKey": false,
3230
+ "notNull": true,
3231
+ "default": "now()"
3232
+ },
3233
+ "last_seen_at": {
3234
+ "name": "last_seen_at",
3235
+ "type": "timestamp with time zone",
3236
+ "primaryKey": false,
3237
+ "notNull": true,
3238
+ "default": "now()"
3239
+ },
3240
+ "trust_score": {
3241
+ "name": "trust_score",
3242
+ "type": "smallint",
3243
+ "primaryKey": false,
3244
+ "notNull": true,
3245
+ "default": 50
3246
+ },
3247
+ "new_device_alert_sent": {
3248
+ "name": "new_device_alert_sent",
3249
+ "type": "boolean",
3250
+ "primaryKey": false,
3251
+ "notNull": true,
3252
+ "default": false
3253
+ }
3254
+ },
3255
+ "indexes": {
3256
+ "user_devices_user_idx": {
3257
+ "name": "user_devices_user_idx",
3258
+ "columns": [
3259
+ {
3260
+ "expression": "user_id",
3261
+ "isExpression": false,
3262
+ "asc": true,
3263
+ "nulls": "last"
3264
+ }
3265
+ ],
3266
+ "isUnique": false,
3267
+ "concurrently": false,
3268
+ "method": "btree",
3269
+ "with": {}
3270
+ }
3271
+ },
3272
+ "foreignKeys": {
3273
+ "user_devices_user_id_users_id_fk": {
3274
+ "name": "user_devices_user_id_users_id_fk",
3275
+ "tableFrom": "user_devices",
3276
+ "tableTo": "users",
3277
+ "columnsFrom": [
3278
+ "user_id"
3279
+ ],
3280
+ "columnsTo": [
3281
+ "id"
3282
+ ],
3283
+ "onDelete": "cascade",
3284
+ "onUpdate": "no action"
3285
+ }
3286
+ },
3287
+ "compositePrimaryKeys": {},
3288
+ "uniqueConstraints": {
3289
+ "user_devices_unique": {
3290
+ "name": "user_devices_unique",
3291
+ "nullsNotDistinct": false,
3292
+ "columns": [
3293
+ "user_id",
3294
+ "fingerprint_hash"
3295
+ ]
3296
+ }
3297
+ },
3298
+ "policies": {},
3299
+ "checkConstraints": {},
3300
+ "isRLSEnabled": false
3301
+ },
3302
+ "public.user_identities": {
3303
+ "name": "user_identities",
3304
+ "schema": "",
3305
+ "columns": {
3306
+ "id": {
3307
+ "name": "id",
3308
+ "type": "uuid",
3309
+ "primaryKey": true,
3310
+ "notNull": true,
3311
+ "default": "gen_random_uuid()"
3312
+ },
3313
+ "user_id": {
3314
+ "name": "user_id",
3315
+ "type": "uuid",
3316
+ "primaryKey": false,
3317
+ "notNull": true
3318
+ },
3319
+ "provider_id": {
3320
+ "name": "provider_id",
3321
+ "type": "uuid",
3322
+ "primaryKey": false,
3323
+ "notNull": true
3324
+ },
3325
+ "provider_type": {
3326
+ "name": "provider_type",
3327
+ "type": "text",
3328
+ "primaryKey": false,
3329
+ "notNull": true
3330
+ },
3331
+ "external_sub": {
3332
+ "name": "external_sub",
3333
+ "type": "text",
3334
+ "primaryKey": false,
3335
+ "notNull": true
3336
+ },
3337
+ "email": {
3338
+ "name": "email",
3339
+ "type": "text",
3340
+ "primaryKey": false,
3341
+ "notNull": false
3342
+ },
3343
+ "profile": {
3344
+ "name": "profile",
3345
+ "type": "jsonb",
3346
+ "primaryKey": false,
3347
+ "notNull": true,
3348
+ "default": "'{}'::jsonb"
3349
+ },
3350
+ "linked_at": {
3351
+ "name": "linked_at",
3352
+ "type": "timestamp with time zone",
3353
+ "primaryKey": false,
3354
+ "notNull": true,
3355
+ "default": "now()"
3356
+ }
3357
+ },
3358
+ "indexes": {
3359
+ "user_identities_user_idx": {
3360
+ "name": "user_identities_user_idx",
3361
+ "columns": [
3362
+ {
3363
+ "expression": "user_id",
3364
+ "isExpression": false,
3365
+ "asc": true,
3366
+ "nulls": "last"
3367
+ }
3368
+ ],
3369
+ "isUnique": false,
3370
+ "concurrently": false,
3371
+ "method": "btree",
3372
+ "with": {}
3373
+ },
3374
+ "user_identities_provider_sub_idx": {
3375
+ "name": "user_identities_provider_sub_idx",
3376
+ "columns": [
3377
+ {
3378
+ "expression": "provider_id",
3379
+ "isExpression": false,
3380
+ "asc": true,
3381
+ "nulls": "last"
3382
+ },
3383
+ {
3384
+ "expression": "external_sub",
3385
+ "isExpression": false,
3386
+ "asc": true,
3387
+ "nulls": "last"
3388
+ }
3389
+ ],
3390
+ "isUnique": false,
3391
+ "concurrently": false,
3392
+ "method": "btree",
3393
+ "with": {}
3394
+ }
3395
+ },
3396
+ "foreignKeys": {
3397
+ "user_identities_user_id_users_id_fk": {
3398
+ "name": "user_identities_user_id_users_id_fk",
3399
+ "tableFrom": "user_identities",
3400
+ "tableTo": "users",
3401
+ "columnsFrom": [
3402
+ "user_id"
3403
+ ],
3404
+ "columnsTo": [
3405
+ "id"
3406
+ ],
3407
+ "onDelete": "cascade",
3408
+ "onUpdate": "no action"
3409
+ },
3410
+ "user_identities_provider_id_identity_providers_id_fk": {
3411
+ "name": "user_identities_provider_id_identity_providers_id_fk",
3412
+ "tableFrom": "user_identities",
3413
+ "tableTo": "identity_providers",
3414
+ "columnsFrom": [
3415
+ "provider_id"
3416
+ ],
3417
+ "columnsTo": [
3418
+ "id"
3419
+ ],
3420
+ "onDelete": "cascade",
3421
+ "onUpdate": "no action"
3422
+ }
3423
+ },
3424
+ "compositePrimaryKeys": {},
3425
+ "uniqueConstraints": {},
3426
+ "policies": {},
3427
+ "checkConstraints": {},
3428
+ "isRLSEnabled": false
3429
+ },
3430
+ "public.user_sessions": {
3431
+ "name": "user_sessions",
3432
+ "schema": "",
3433
+ "columns": {
3434
+ "id": {
3435
+ "name": "id",
3436
+ "type": "uuid",
3437
+ "primaryKey": true,
3438
+ "notNull": true,
3439
+ "default": "gen_random_uuid()"
3440
+ },
3441
+ "user_id": {
3442
+ "name": "user_id",
3443
+ "type": "uuid",
3444
+ "primaryKey": false,
3445
+ "notNull": true
3446
+ },
3447
+ "refresh_token_id": {
3448
+ "name": "refresh_token_id",
3449
+ "type": "text",
3450
+ "primaryKey": false,
3451
+ "notNull": true
3452
+ },
3453
+ "device_fingerprint": {
3454
+ "name": "device_fingerprint",
3455
+ "type": "text",
3456
+ "primaryKey": false,
3457
+ "notNull": false
3458
+ },
3459
+ "ip_address": {
3460
+ "name": "ip_address",
3461
+ "type": "text",
3462
+ "primaryKey": false,
3463
+ "notNull": false
3464
+ },
3465
+ "user_agent": {
3466
+ "name": "user_agent",
3467
+ "type": "text",
3468
+ "primaryKey": false,
3469
+ "notNull": false
3470
+ },
3471
+ "last_seen_at": {
3472
+ "name": "last_seen_at",
3473
+ "type": "timestamp with time zone",
3474
+ "primaryKey": false,
3475
+ "notNull": true,
3476
+ "default": "now()"
3477
+ },
3478
+ "expires_at": {
3479
+ "name": "expires_at",
3480
+ "type": "timestamp with time zone",
3481
+ "primaryKey": false,
3482
+ "notNull": true
3483
+ },
3484
+ "revoked_at": {
3485
+ "name": "revoked_at",
3486
+ "type": "timestamp with time zone",
3487
+ "primaryKey": false,
3488
+ "notNull": false
3489
+ },
3490
+ "created_at": {
3491
+ "name": "created_at",
3492
+ "type": "timestamp with time zone",
3493
+ "primaryKey": false,
3494
+ "notNull": true,
3495
+ "default": "now()"
3496
+ }
3497
+ },
3498
+ "indexes": {
3499
+ "user_sessions_user_idx": {
3500
+ "name": "user_sessions_user_idx",
3501
+ "columns": [
3502
+ {
3503
+ "expression": "user_id",
3504
+ "isExpression": false,
3505
+ "asc": true,
3506
+ "nulls": "last"
3507
+ }
3508
+ ],
3509
+ "isUnique": false,
3510
+ "concurrently": false,
3511
+ "method": "btree",
3512
+ "with": {}
3513
+ },
3514
+ "user_sessions_refresh_token_idx": {
3515
+ "name": "user_sessions_refresh_token_idx",
3516
+ "columns": [
3517
+ {
3518
+ "expression": "refresh_token_id",
3519
+ "isExpression": false,
3520
+ "asc": true,
3521
+ "nulls": "last"
3522
+ }
3523
+ ],
3524
+ "isUnique": false,
3525
+ "concurrently": false,
3526
+ "method": "btree",
3527
+ "with": {}
3528
+ }
3529
+ },
3530
+ "foreignKeys": {
3531
+ "user_sessions_user_id_users_id_fk": {
3532
+ "name": "user_sessions_user_id_users_id_fk",
3533
+ "tableFrom": "user_sessions",
3534
+ "tableTo": "users",
3535
+ "columnsFrom": [
3536
+ "user_id"
3537
+ ],
3538
+ "columnsTo": [
3539
+ "id"
3540
+ ],
3541
+ "onDelete": "cascade",
3542
+ "onUpdate": "no action"
3543
+ }
3544
+ },
3545
+ "compositePrimaryKeys": {},
3546
+ "uniqueConstraints": {},
3547
+ "policies": {},
3548
+ "checkConstraints": {},
3549
+ "isRLSEnabled": false
3550
+ },
3551
+ "public.users": {
3552
+ "name": "users",
3553
+ "schema": "",
3554
+ "columns": {
3555
+ "id": {
3556
+ "name": "id",
3557
+ "type": "uuid",
3558
+ "primaryKey": true,
3559
+ "notNull": true,
3560
+ "default": "gen_random_uuid()"
3561
+ },
3562
+ "zitadel_user_id": {
3563
+ "name": "zitadel_user_id",
3564
+ "type": "text",
3565
+ "primaryKey": false,
3566
+ "notNull": false
3567
+ },
3568
+ "email": {
3569
+ "name": "email",
3570
+ "type": "text",
3571
+ "primaryKey": false,
3572
+ "notNull": true
3573
+ },
3574
+ "username": {
3575
+ "name": "username",
3576
+ "type": "text",
3577
+ "primaryKey": false,
3578
+ "notNull": true
3579
+ },
3580
+ "name": {
3581
+ "name": "name",
3582
+ "type": "text",
3583
+ "primaryKey": false,
3584
+ "notNull": false
3585
+ },
3586
+ "avatar_url": {
3587
+ "name": "avatar_url",
3588
+ "type": "text",
3589
+ "primaryKey": false,
3590
+ "notNull": false
3591
+ },
3592
+ "email_verified": {
3593
+ "name": "email_verified",
3594
+ "type": "boolean",
3595
+ "primaryKey": false,
3596
+ "notNull": true,
3597
+ "default": false
3598
+ },
3599
+ "email_verified_token": {
3600
+ "name": "email_verified_token",
3601
+ "type": "text",
3602
+ "primaryKey": false,
3603
+ "notNull": false
3604
+ },
3605
+ "provider": {
3606
+ "name": "provider",
3607
+ "type": "text",
3608
+ "primaryKey": false,
3609
+ "notNull": true,
3610
+ "default": "'password'"
3611
+ },
3612
+ "plan": {
3613
+ "name": "plan",
3614
+ "type": "text",
3615
+ "primaryKey": false,
3616
+ "notNull": true,
3617
+ "default": "'free'"
3618
+ },
3619
+ "role": {
3620
+ "name": "role",
3621
+ "type": "text",
3622
+ "primaryKey": false,
3623
+ "notNull": true,
3624
+ "default": "'user'"
3625
+ },
3626
+ "is_active": {
3627
+ "name": "is_active",
3628
+ "type": "boolean",
3629
+ "primaryKey": false,
3630
+ "notNull": true,
3631
+ "default": true
3632
+ },
3633
+ "account_review_required": {
3634
+ "name": "account_review_required",
3635
+ "type": "boolean",
3636
+ "primaryKey": false,
3637
+ "notNull": true,
3638
+ "default": false
3639
+ },
3640
+ "default_org_id": {
3641
+ "name": "default_org_id",
3642
+ "type": "uuid",
3643
+ "primaryKey": false,
3644
+ "notNull": false
3645
+ },
3646
+ "phone_number": {
3647
+ "name": "phone_number",
3648
+ "type": "text",
3649
+ "primaryKey": false,
3650
+ "notNull": false
3651
+ },
3652
+ "phone_verified": {
3653
+ "name": "phone_verified",
3654
+ "type": "boolean",
3655
+ "primaryKey": false,
3656
+ "notNull": true,
3657
+ "default": false
3658
+ },
3659
+ "metadata": {
3660
+ "name": "metadata",
3661
+ "type": "jsonb",
3662
+ "primaryKey": false,
3663
+ "notNull": true,
3664
+ "default": "'{}'::jsonb"
3665
+ },
3666
+ "password_hash": {
3667
+ "name": "password_hash",
3668
+ "type": "text",
3669
+ "primaryKey": false,
3670
+ "notNull": false
3671
+ },
3672
+ "totp_secret": {
3673
+ "name": "totp_secret",
3674
+ "type": "text",
3675
+ "primaryKey": false,
3676
+ "notNull": false
3677
+ },
3678
+ "totp_enabled": {
3679
+ "name": "totp_enabled",
3680
+ "type": "boolean",
3681
+ "primaryKey": false,
3682
+ "notNull": true,
3683
+ "default": false
3684
+ },
3685
+ "totp_verified_at": {
3686
+ "name": "totp_verified_at",
3687
+ "type": "timestamp with time zone",
3688
+ "primaryKey": false,
3689
+ "notNull": false
3690
+ },
3691
+ "totp_last_step": {
3692
+ "name": "totp_last_step",
3693
+ "type": "bigint",
3694
+ "primaryKey": false,
3695
+ "notNull": false
3696
+ },
3697
+ "failed_login_attempts": {
3698
+ "name": "failed_login_attempts",
3699
+ "type": "integer",
3700
+ "primaryKey": false,
3701
+ "notNull": true,
3702
+ "default": 0
3703
+ },
3704
+ "locked_until": {
3705
+ "name": "locked_until",
3706
+ "type": "timestamp with time zone",
3707
+ "primaryKey": false,
3708
+ "notNull": false
3709
+ },
3710
+ "created_at": {
3711
+ "name": "created_at",
3712
+ "type": "timestamp with time zone",
3713
+ "primaryKey": false,
3714
+ "notNull": true,
3715
+ "default": "now()"
3716
+ },
3717
+ "updated_at": {
3718
+ "name": "updated_at",
3719
+ "type": "timestamp with time zone",
3720
+ "primaryKey": false,
3721
+ "notNull": true,
3722
+ "default": "now()"
3723
+ }
3724
+ },
3725
+ "indexes": {
3726
+ "users_email_idx": {
3727
+ "name": "users_email_idx",
3728
+ "columns": [
3729
+ {
3730
+ "expression": "email",
3731
+ "isExpression": false,
3732
+ "asc": true,
3733
+ "nulls": "last"
3734
+ }
3735
+ ],
3736
+ "isUnique": false,
3737
+ "concurrently": false,
3738
+ "method": "btree",
3739
+ "with": {}
3740
+ },
3741
+ "users_zitadel_idx": {
3742
+ "name": "users_zitadel_idx",
3743
+ "columns": [
3744
+ {
3745
+ "expression": "zitadel_user_id",
3746
+ "isExpression": false,
3747
+ "asc": true,
3748
+ "nulls": "last"
3749
+ }
3750
+ ],
3751
+ "isUnique": false,
3752
+ "concurrently": false,
3753
+ "method": "btree",
3754
+ "with": {}
3755
+ },
3756
+ "users_default_org_idx": {
3757
+ "name": "users_default_org_idx",
3758
+ "columns": [
3759
+ {
3760
+ "expression": "default_org_id",
3761
+ "isExpression": false,
3762
+ "asc": true,
3763
+ "nulls": "last"
3764
+ }
3765
+ ],
3766
+ "isUnique": false,
3767
+ "concurrently": false,
3768
+ "method": "btree",
3769
+ "with": {}
3770
+ }
3771
+ },
3772
+ "foreignKeys": {
3773
+ "users_default_org_id_organizations_id_fk": {
3774
+ "name": "users_default_org_id_organizations_id_fk",
3775
+ "tableFrom": "users",
3776
+ "tableTo": "organizations",
3777
+ "columnsFrom": [
3778
+ "default_org_id"
3779
+ ],
3780
+ "columnsTo": [
3781
+ "id"
3782
+ ],
3783
+ "onDelete": "set null",
3784
+ "onUpdate": "no action"
3785
+ }
3786
+ },
3787
+ "compositePrimaryKeys": {},
3788
+ "uniqueConstraints": {
3789
+ "users_zitadel_user_id_unique": {
3790
+ "name": "users_zitadel_user_id_unique",
3791
+ "nullsNotDistinct": false,
3792
+ "columns": [
3793
+ "zitadel_user_id"
3794
+ ]
3795
+ },
3796
+ "users_email_unique": {
3797
+ "name": "users_email_unique",
3798
+ "nullsNotDistinct": false,
3799
+ "columns": [
3800
+ "email"
3801
+ ]
3802
+ },
3803
+ "users_username_unique": {
3804
+ "name": "users_username_unique",
3805
+ "nullsNotDistinct": false,
3806
+ "columns": [
3807
+ "username"
3808
+ ]
3809
+ }
3810
+ },
3811
+ "policies": {},
3812
+ "checkConstraints": {
3813
+ "users_platform_role_check": {
3814
+ "name": "users_platform_role_check",
3815
+ "value": "role in ('owner', 'user')"
3816
+ }
3817
+ },
3818
+ "isRLSEnabled": false
3819
+ },
3820
+ "public.webauthn_credentials": {
3821
+ "name": "webauthn_credentials",
3822
+ "schema": "",
3823
+ "columns": {
3824
+ "id": {
3825
+ "name": "id",
3826
+ "type": "uuid",
3827
+ "primaryKey": true,
3828
+ "notNull": true,
3829
+ "default": "gen_random_uuid()"
3830
+ },
3831
+ "user_id": {
3832
+ "name": "user_id",
3833
+ "type": "uuid",
3834
+ "primaryKey": false,
3835
+ "notNull": true
3836
+ },
3837
+ "credential_id": {
3838
+ "name": "credential_id",
3839
+ "type": "text",
3840
+ "primaryKey": false,
3841
+ "notNull": true
3842
+ },
3843
+ "public_key": {
3844
+ "name": "public_key",
3845
+ "type": "text",
3846
+ "primaryKey": false,
3847
+ "notNull": true
3848
+ },
3849
+ "counter": {
3850
+ "name": "counter",
3851
+ "type": "integer",
3852
+ "primaryKey": false,
3853
+ "notNull": true,
3854
+ "default": 0
3855
+ },
3856
+ "transports": {
3857
+ "name": "transports",
3858
+ "type": "text[]",
3859
+ "primaryKey": false,
3860
+ "notNull": true,
3861
+ "default": "'{}'::text[]"
3862
+ },
3863
+ "aaguid": {
3864
+ "name": "aaguid",
3865
+ "type": "text",
3866
+ "primaryKey": false,
3867
+ "notNull": false
3868
+ },
3869
+ "device_name": {
3870
+ "name": "device_name",
3871
+ "type": "text",
3872
+ "primaryKey": false,
3873
+ "notNull": false
3874
+ },
3875
+ "last_used_at": {
3876
+ "name": "last_used_at",
3877
+ "type": "timestamp with time zone",
3878
+ "primaryKey": false,
3879
+ "notNull": false
3880
+ },
3881
+ "created_at": {
3882
+ "name": "created_at",
3883
+ "type": "timestamp with time zone",
3884
+ "primaryKey": false,
3885
+ "notNull": true,
3886
+ "default": "now()"
3887
+ }
3888
+ },
3889
+ "indexes": {
3890
+ "webauthn_credentials_user_idx": {
3891
+ "name": "webauthn_credentials_user_idx",
3892
+ "columns": [
3893
+ {
3894
+ "expression": "user_id",
3895
+ "isExpression": false,
3896
+ "asc": true,
3897
+ "nulls": "last"
3898
+ }
3899
+ ],
3900
+ "isUnique": false,
3901
+ "concurrently": false,
3902
+ "method": "btree",
3903
+ "with": {}
3904
+ }
3905
+ },
3906
+ "foreignKeys": {
3907
+ "webauthn_credentials_user_id_users_id_fk": {
3908
+ "name": "webauthn_credentials_user_id_users_id_fk",
3909
+ "tableFrom": "webauthn_credentials",
3910
+ "tableTo": "users",
3911
+ "columnsFrom": [
3912
+ "user_id"
3913
+ ],
3914
+ "columnsTo": [
3915
+ "id"
3916
+ ],
3917
+ "onDelete": "cascade",
3918
+ "onUpdate": "no action"
3919
+ }
3920
+ },
3921
+ "compositePrimaryKeys": {},
3922
+ "uniqueConstraints": {
3923
+ "webauthn_credentials_credential_id_unique": {
3924
+ "name": "webauthn_credentials_credential_id_unique",
3925
+ "nullsNotDistinct": false,
3926
+ "columns": [
3927
+ "credential_id"
3928
+ ]
3929
+ }
3930
+ },
3931
+ "policies": {},
3932
+ "checkConstraints": {},
3933
+ "isRLSEnabled": false
3934
+ },
3935
+ "public.webhook_deliveries": {
3936
+ "name": "webhook_deliveries",
3937
+ "schema": "",
3938
+ "columns": {
3939
+ "id": {
3940
+ "name": "id",
3941
+ "type": "uuid",
3942
+ "primaryKey": true,
3943
+ "notNull": true,
3944
+ "default": "gen_random_uuid()"
3945
+ },
3946
+ "endpoint_id": {
3947
+ "name": "endpoint_id",
3948
+ "type": "uuid",
3949
+ "primaryKey": false,
3950
+ "notNull": true
3951
+ },
3952
+ "event_type": {
3953
+ "name": "event_type",
3954
+ "type": "text",
3955
+ "primaryKey": false,
3956
+ "notNull": true
3957
+ },
3958
+ "payload": {
3959
+ "name": "payload",
3960
+ "type": "jsonb",
3961
+ "primaryKey": false,
3962
+ "notNull": true,
3963
+ "default": "'{}'::jsonb"
3964
+ },
3965
+ "status": {
3966
+ "name": "status",
3967
+ "type": "text",
3968
+ "primaryKey": false,
3969
+ "notNull": true,
3970
+ "default": "'pending'"
3971
+ },
3972
+ "attempts": {
3973
+ "name": "attempts",
3974
+ "type": "integer",
3975
+ "primaryKey": false,
3976
+ "notNull": true,
3977
+ "default": 0
3978
+ },
3979
+ "response_status": {
3980
+ "name": "response_status",
3981
+ "type": "integer",
3982
+ "primaryKey": false,
3983
+ "notNull": false
3984
+ },
3985
+ "response_body": {
3986
+ "name": "response_body",
3987
+ "type": "text",
3988
+ "primaryKey": false,
3989
+ "notNull": false
3990
+ },
3991
+ "last_attempt_at": {
3992
+ "name": "last_attempt_at",
3993
+ "type": "timestamp with time zone",
3994
+ "primaryKey": false,
3995
+ "notNull": false
3996
+ },
3997
+ "created_at": {
3998
+ "name": "created_at",
3999
+ "type": "timestamp with time zone",
4000
+ "primaryKey": false,
4001
+ "notNull": true,
4002
+ "default": "now()"
4003
+ }
4004
+ },
4005
+ "indexes": {
4006
+ "webhook_deliveries_endpoint_idx": {
4007
+ "name": "webhook_deliveries_endpoint_idx",
4008
+ "columns": [
4009
+ {
4010
+ "expression": "endpoint_id",
4011
+ "isExpression": false,
4012
+ "asc": true,
4013
+ "nulls": "last"
4014
+ }
4015
+ ],
4016
+ "isUnique": false,
4017
+ "concurrently": false,
4018
+ "method": "btree",
4019
+ "with": {}
4020
+ },
4021
+ "webhook_deliveries_status_idx": {
4022
+ "name": "webhook_deliveries_status_idx",
4023
+ "columns": [
4024
+ {
4025
+ "expression": "status",
4026
+ "isExpression": false,
4027
+ "asc": true,
4028
+ "nulls": "last"
4029
+ }
4030
+ ],
4031
+ "isUnique": false,
4032
+ "concurrently": false,
4033
+ "method": "btree",
4034
+ "with": {}
4035
+ }
4036
+ },
4037
+ "foreignKeys": {
4038
+ "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk": {
4039
+ "name": "webhook_deliveries_endpoint_id_webhook_endpoints_id_fk",
4040
+ "tableFrom": "webhook_deliveries",
4041
+ "tableTo": "webhook_endpoints",
4042
+ "columnsFrom": [
4043
+ "endpoint_id"
4044
+ ],
4045
+ "columnsTo": [
4046
+ "id"
4047
+ ],
4048
+ "onDelete": "cascade",
4049
+ "onUpdate": "no action"
4050
+ }
4051
+ },
4052
+ "compositePrimaryKeys": {},
4053
+ "uniqueConstraints": {},
4054
+ "policies": {},
4055
+ "checkConstraints": {},
4056
+ "isRLSEnabled": false
4057
+ },
4058
+ "public.webhook_endpoints": {
4059
+ "name": "webhook_endpoints",
4060
+ "schema": "",
4061
+ "columns": {
4062
+ "id": {
4063
+ "name": "id",
4064
+ "type": "uuid",
4065
+ "primaryKey": true,
4066
+ "notNull": true,
4067
+ "default": "gen_random_uuid()"
4068
+ },
4069
+ "app_id": {
4070
+ "name": "app_id",
4071
+ "type": "uuid",
4072
+ "primaryKey": false,
4073
+ "notNull": false
4074
+ },
4075
+ "url": {
4076
+ "name": "url",
4077
+ "type": "text",
4078
+ "primaryKey": false,
4079
+ "notNull": true
4080
+ },
4081
+ "description": {
4082
+ "name": "description",
4083
+ "type": "text",
4084
+ "primaryKey": false,
4085
+ "notNull": false
4086
+ },
4087
+ "events": {
4088
+ "name": "events",
4089
+ "type": "text[]",
4090
+ "primaryKey": false,
4091
+ "notNull": true,
4092
+ "default": "'{}'::text[]"
4093
+ },
4094
+ "secret": {
4095
+ "name": "secret",
4096
+ "type": "text",
4097
+ "primaryKey": false,
4098
+ "notNull": true
4099
+ },
4100
+ "is_active": {
4101
+ "name": "is_active",
4102
+ "type": "boolean",
4103
+ "primaryKey": false,
4104
+ "notNull": true,
4105
+ "default": true
4106
+ },
4107
+ "created_at": {
4108
+ "name": "created_at",
4109
+ "type": "timestamp with time zone",
4110
+ "primaryKey": false,
4111
+ "notNull": true,
4112
+ "default": "now()"
4113
+ },
4114
+ "updated_at": {
4115
+ "name": "updated_at",
4116
+ "type": "timestamp with time zone",
4117
+ "primaryKey": false,
4118
+ "notNull": true,
4119
+ "default": "now()"
4120
+ }
4121
+ },
4122
+ "indexes": {
4123
+ "webhook_endpoints_app_idx": {
4124
+ "name": "webhook_endpoints_app_idx",
4125
+ "columns": [
4126
+ {
4127
+ "expression": "app_id",
4128
+ "isExpression": false,
4129
+ "asc": true,
4130
+ "nulls": "last"
4131
+ }
4132
+ ],
4133
+ "isUnique": false,
4134
+ "concurrently": false,
4135
+ "method": "btree",
4136
+ "with": {}
4137
+ }
4138
+ },
4139
+ "foreignKeys": {
4140
+ "webhook_endpoints_app_id_applications_id_fk": {
4141
+ "name": "webhook_endpoints_app_id_applications_id_fk",
4142
+ "tableFrom": "webhook_endpoints",
4143
+ "tableTo": "applications",
4144
+ "columnsFrom": [
4145
+ "app_id"
4146
+ ],
4147
+ "columnsTo": [
4148
+ "id"
4149
+ ],
4150
+ "onDelete": "cascade",
4151
+ "onUpdate": "no action"
4152
+ }
4153
+ },
4154
+ "compositePrimaryKeys": {},
4155
+ "uniqueConstraints": {},
4156
+ "policies": {},
4157
+ "checkConstraints": {},
4158
+ "isRLSEnabled": false
4159
+ },
4160
+ "public.workflow_runs": {
4161
+ "name": "workflow_runs",
4162
+ "schema": "",
4163
+ "columns": {
4164
+ "id": {
4165
+ "name": "id",
4166
+ "type": "uuid",
4167
+ "primaryKey": true,
4168
+ "notNull": true,
4169
+ "default": "gen_random_uuid()"
4170
+ },
4171
+ "workflow_id": {
4172
+ "name": "workflow_id",
4173
+ "type": "uuid",
4174
+ "primaryKey": false,
4175
+ "notNull": true
4176
+ },
4177
+ "trigger_event": {
4178
+ "name": "trigger_event",
4179
+ "type": "text",
4180
+ "primaryKey": false,
4181
+ "notNull": true
4182
+ },
4183
+ "payload": {
4184
+ "name": "payload",
4185
+ "type": "jsonb",
4186
+ "primaryKey": false,
4187
+ "notNull": true,
4188
+ "default": "'{}'::jsonb"
4189
+ },
4190
+ "status": {
4191
+ "name": "status",
4192
+ "type": "text",
4193
+ "primaryKey": false,
4194
+ "notNull": true,
4195
+ "default": "'pending'"
4196
+ },
4197
+ "started_at": {
4198
+ "name": "started_at",
4199
+ "type": "timestamp with time zone",
4200
+ "primaryKey": false,
4201
+ "notNull": false
4202
+ },
4203
+ "finished_at": {
4204
+ "name": "finished_at",
4205
+ "type": "timestamp with time zone",
4206
+ "primaryKey": false,
4207
+ "notNull": false
4208
+ },
4209
+ "log": {
4210
+ "name": "log",
4211
+ "type": "jsonb",
4212
+ "primaryKey": false,
4213
+ "notNull": true,
4214
+ "default": "'[]'::jsonb"
4215
+ }
4216
+ },
4217
+ "indexes": {
4218
+ "workflow_runs_workflow_idx": {
4219
+ "name": "workflow_runs_workflow_idx",
4220
+ "columns": [
4221
+ {
4222
+ "expression": "workflow_id",
4223
+ "isExpression": false,
4224
+ "asc": true,
4225
+ "nulls": "last"
4226
+ }
4227
+ ],
4228
+ "isUnique": false,
4229
+ "concurrently": false,
4230
+ "method": "btree",
4231
+ "with": {}
4232
+ }
4233
+ },
4234
+ "foreignKeys": {
4235
+ "workflow_runs_workflow_id_workflows_id_fk": {
4236
+ "name": "workflow_runs_workflow_id_workflows_id_fk",
4237
+ "tableFrom": "workflow_runs",
4238
+ "tableTo": "workflows",
4239
+ "columnsFrom": [
4240
+ "workflow_id"
4241
+ ],
4242
+ "columnsTo": [
4243
+ "id"
4244
+ ],
4245
+ "onDelete": "cascade",
4246
+ "onUpdate": "no action"
4247
+ }
4248
+ },
4249
+ "compositePrimaryKeys": {},
4250
+ "uniqueConstraints": {},
4251
+ "policies": {},
4252
+ "checkConstraints": {},
4253
+ "isRLSEnabled": false
4254
+ },
4255
+ "public.workflows": {
4256
+ "name": "workflows",
4257
+ "schema": "",
4258
+ "columns": {
4259
+ "id": {
4260
+ "name": "id",
4261
+ "type": "uuid",
4262
+ "primaryKey": true,
4263
+ "notNull": true,
4264
+ "default": "gen_random_uuid()"
4265
+ },
4266
+ "org_id": {
4267
+ "name": "org_id",
4268
+ "type": "uuid",
4269
+ "primaryKey": false,
4270
+ "notNull": false
4271
+ },
4272
+ "name": {
4273
+ "name": "name",
4274
+ "type": "text",
4275
+ "primaryKey": false,
4276
+ "notNull": true
4277
+ },
4278
+ "trigger": {
4279
+ "name": "trigger",
4280
+ "type": "text",
4281
+ "primaryKey": false,
4282
+ "notNull": true
4283
+ },
4284
+ "definition": {
4285
+ "name": "definition",
4286
+ "type": "jsonb",
4287
+ "primaryKey": false,
4288
+ "notNull": true,
4289
+ "default": "'{}'::jsonb"
4290
+ },
4291
+ "is_active": {
4292
+ "name": "is_active",
4293
+ "type": "boolean",
4294
+ "primaryKey": false,
4295
+ "notNull": true,
4296
+ "default": true
4297
+ },
4298
+ "created_at": {
4299
+ "name": "created_at",
4300
+ "type": "timestamp with time zone",
4301
+ "primaryKey": false,
4302
+ "notNull": true,
4303
+ "default": "now()"
4304
+ },
4305
+ "updated_at": {
4306
+ "name": "updated_at",
4307
+ "type": "timestamp with time zone",
4308
+ "primaryKey": false,
4309
+ "notNull": true,
4310
+ "default": "now()"
4311
+ }
4312
+ },
4313
+ "indexes": {
4314
+ "workflows_trigger_idx": {
4315
+ "name": "workflows_trigger_idx",
4316
+ "columns": [
4317
+ {
4318
+ "expression": "trigger",
4319
+ "isExpression": false,
4320
+ "asc": true,
4321
+ "nulls": "last"
4322
+ }
4323
+ ],
4324
+ "isUnique": false,
4325
+ "concurrently": false,
4326
+ "method": "btree",
4327
+ "with": {}
4328
+ }
4329
+ },
4330
+ "foreignKeys": {
4331
+ "workflows_org_id_organizations_id_fk": {
4332
+ "name": "workflows_org_id_organizations_id_fk",
4333
+ "tableFrom": "workflows",
4334
+ "tableTo": "organizations",
4335
+ "columnsFrom": [
4336
+ "org_id"
4337
+ ],
4338
+ "columnsTo": [
4339
+ "id"
4340
+ ],
4341
+ "onDelete": "cascade",
4342
+ "onUpdate": "no action"
4343
+ }
4344
+ },
4345
+ "compositePrimaryKeys": {},
4346
+ "uniqueConstraints": {},
4347
+ "policies": {},
4348
+ "checkConstraints": {},
4349
+ "isRLSEnabled": false
4350
+ }
4351
+ },
4352
+ "enums": {},
4353
+ "schemas": {},
4354
+ "sequences": {},
4355
+ "roles": {},
4356
+ "policies": {},
4357
+ "views": {},
4358
+ "_meta": {
4359
+ "columns": {},
4360
+ "schemas": {},
4361
+ "tables": {}
4362
+ }
4363
+ }