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