@hilbras/keystone 1.6.0 → 2.5.0

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