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