@intelligo-dev/core 1.0.0-beta.1 → 1.0.0-beta.14

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