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

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 (355) 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 +136 -107
  56. package/dist/db/schema/billing.d.ts.map +1 -1
  57. package/dist/db/schema/billing.js +72 -60
  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 +5 -13
  182. package/dist/identity/index.d.ts.map +1 -1
  183. package/dist/identity/index.js +4 -12
  184. package/dist/identity/index.js.map +1 -1
  185. package/dist/identity/service.d.ts +13 -47
  186. package/dist/identity/service.d.ts.map +1 -1
  187. package/dist/identity/service.js +31 -78
  188. package/dist/identity/service.js.map +1 -1
  189. package/dist/identity/types.d.ts +1 -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 +1 -10
  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/README.md +74 -36
  248. package/src/db/migrations/legacy-chain.json +197 -0
  249. package/src/db/migrations/meta/0000_snapshot.json +4182 -157
  250. package/src/db/migrations/meta/0002_snapshot.json +2478 -368
  251. package/src/db/migrations/meta/_journal.json +6 -279
  252. package/src/db/schema/agents.ts +57 -0
  253. package/src/db/schema/ai.ts +174 -0
  254. package/src/db/schema/auth.ts +183 -0
  255. package/src/db/schema/billing.ts +209 -0
  256. package/src/db/schema/feature-flags.ts +20 -0
  257. package/src/db/schema/identity.ts +250 -0
  258. package/src/db/schema/index.ts +12 -0
  259. package/src/db/schema/notifications.ts +31 -0
  260. package/src/db/schema/usage.ts +269 -0
  261. package/src/db/validate.ts +63 -0
  262. package/src/db/workspace-queries.ts +64 -0
  263. package/src/documents/classifier.ts +61 -0
  264. package/src/documents/errors.ts +44 -0
  265. package/src/documents/index.ts +24 -0
  266. package/src/documents/service.ts +256 -0
  267. package/src/documents/types.ts +24 -0
  268. package/src/email/brand.ts +24 -0
  269. package/src/email/index.ts +19 -0
  270. package/src/email/provider.ts +278 -0
  271. package/src/email/send.ts +169 -0
  272. package/src/email/senders.ts +292 -0
  273. package/src/email/templates/base-layout.tsx +145 -0
  274. package/src/email/templates/index.ts +28 -0
  275. package/src/email/templates/password-reset.tsx +72 -0
  276. package/src/email/templates/payment-failed.tsx +77 -0
  277. package/src/email/templates/quota-warning.tsx +118 -0
  278. package/src/email/templates/subscription-confirmed.tsx +91 -0
  279. package/src/email/templates/trial-expiry.tsx +124 -0
  280. package/src/email/templates/trial-warning.tsx +104 -0
  281. package/src/email/templates/verify-email.tsx +72 -0
  282. package/src/email/templates/welcome.tsx +64 -0
  283. package/src/email/templates/workspace-invitation.tsx +105 -0
  284. package/src/env.ts +180 -0
  285. package/src/identity/audit.ts +65 -0
  286. package/src/identity/errors.ts +44 -0
  287. package/src/identity/index.ts +26 -0
  288. package/src/identity/service.ts +202 -0
  289. package/src/identity/types.ts +28 -0
  290. package/src/index.ts +4 -0
  291. package/src/logger.ts +198 -0
  292. package/src/money.ts +270 -0
  293. package/src/notifications/index.ts +108 -0
  294. package/src/notifications/triggers.ts +158 -0
  295. package/src/notifications/types.ts +18 -0
  296. package/src/prompt.ts +142 -0
  297. package/src/registry.ts +75 -0
  298. package/src/request-context.ts +137 -0
  299. package/src/storage/index.ts +153 -0
  300. package/dist/db/schema/rag.d.ts +0 -171
  301. package/dist/db/schema/rag.d.ts.map +0 -1
  302. package/dist/db/schema/rag.js +0 -42
  303. package/dist/db/schema/rag.js.map +0 -1
  304. package/src/db/migrations/0000_sharp_night_nurse.sql +0 -52
  305. package/src/db/migrations/0001_hesitant_vapor.sql +0 -40
  306. package/src/db/migrations/0002_numerous_lady_vermin.sql +0 -235
  307. package/src/db/migrations/0003_mighty_jean_grey.sql +0 -37
  308. package/src/db/migrations/0004_cynical_grandmaster.sql +0 -2
  309. package/src/db/migrations/0005_careful_switch.sql +0 -8
  310. package/src/db/migrations/0006_tense_blue_marvel.sql +0 -16
  311. package/src/db/migrations/0007_next_squadron_sinister.sql +0 -1
  312. package/src/db/migrations/0008_powerful_scream.sql +0 -39
  313. package/src/db/migrations/0009_sad_ink.sql +0 -1
  314. package/src/db/migrations/0010_shocking_omega_flight.sql +0 -2
  315. package/src/db/migrations/0011_ambiguous_otto_octavius.sql +0 -151
  316. package/src/db/migrations/0011_hnsw_vector_index.sql +0 -17
  317. package/src/db/migrations/0012_user_profiles.sql +0 -30
  318. package/src/db/migrations/0013_trending_seasonal_columns.sql +0 -9
  319. package/src/db/migrations/0014_add_product_type_to_agents.sql +0 -6
  320. package/src/db/migrations/0015_new_v1_tables.sql +0 -149
  321. package/src/db/migrations/0016_document_types.sql +0 -30
  322. package/src/db/migrations/0017_document_metadata.sql +0 -2
  323. package/src/db/migrations/0018_identity_graph.sql +0 -200
  324. package/src/db/migrations/0019_db_driven_prompts.sql +0 -20
  325. package/src/db/migrations/0020_pending_extractions.sql +0 -35
  326. package/src/db/migrations/0021_rag_documents.sql +0 -39
  327. package/src/db/migrations/0022_user_quotas_usage_jsonb.sql +0 -70
  328. package/src/db/migrations/0023_user_facts_user_scoped_unique.sql +0 -17
  329. package/src/db/migrations/0024_user_memories_hnsw.sql +0 -23
  330. package/src/db/migrations/0025_audit_trigger_errcode.sql +0 -21
  331. package/src/db/migrations/0026_user_profile_snapshots_composite_pk.sql +0 -17
  332. package/src/db/migrations/0027_billing_settings_mnt_columns.sql +0 -54
  333. package/src/db/migrations/0028_trial_credits_normalized_email.sql +0 -37
  334. package/src/db/migrations/0029_usage_records_conversation_idx.sql +0 -13
  335. package/src/db/migrations/0030_pending_extractions_composite_idx.sql +0 -11
  336. package/src/db/migrations/0031_rag_documents_hnsw.sql +0 -16
  337. package/src/db/migrations/0032_rate_limit_unique_idx.sql +0 -16
  338. package/src/db/migrations/0033_pending_extractions_partial_idx.sql +0 -18
  339. package/src/db/migrations/0034_rate_limit_count.sql +0 -9
  340. package/src/db/migrations/0035_credit_reservations.sql +0 -24
  341. package/src/db/migrations/0036_executions_audit_jobs.sql +0 -96
  342. package/src/db/migrations/0037_rate_limit_minute_bucket.sql +0 -46
  343. package/src/db/migrations/0038_user_quotas_generic_usage.sql +0 -25
  344. package/src/db/migrations/0039_platform_admin_impersonation.sql +0 -27
  345. package/src/db/migrations/0040_ee_audit_chain.sql +0 -23
  346. package/src/db/migrations/meta/0001_snapshot.json +0 -631
  347. package/src/db/migrations/meta/0003_snapshot.json +0 -2488
  348. package/src/db/migrations/meta/0004_snapshot.json +0 -2500
  349. package/src/db/migrations/meta/0005_snapshot.json +0 -2548
  350. package/src/db/migrations/meta/0006_snapshot.json +0 -2650
  351. package/src/db/migrations/meta/0007_snapshot.json +0 -2657
  352. package/src/db/migrations/meta/0008_snapshot.json +0 -2719
  353. package/src/db/migrations/meta/0009_snapshot.json +0 -2726
  354. package/src/db/migrations/meta/0010_snapshot.json +0 -2739
  355. package/src/db/migrations/meta/0011_snapshot.json +0 -3886
@@ -1,2657 +0,0 @@
1
- {
2
- "id": "fdd1a6da-d0ea-4a0d-8656-124fc5c8f32e",
3
- "prevId": "0ce3c9a7-34a6-448b-b5d2-e354c7ea1b80",
4
- "version": "7",
5
- "dialect": "postgresql",
6
- "tables": {
7
- "public.agents": {
8
- "name": "agents",
9
- "schema": "",
10
- "columns": {
11
- "id": {
12
- "name": "id",
13
- "type": "text",
14
- "primaryKey": true,
15
- "notNull": true
16
- },
17
- "name": {
18
- "name": "name",
19
- "type": "jsonb",
20
- "primaryKey": false,
21
- "notNull": true
22
- },
23
- "description": {
24
- "name": "description",
25
- "type": "jsonb",
26
- "primaryKey": false,
27
- "notNull": true
28
- },
29
- "system_prompt_key": {
30
- "name": "system_prompt_key",
31
- "type": "text",
32
- "primaryKey": false,
33
- "notNull": true
34
- },
35
- "icon": {
36
- "name": "icon",
37
- "type": "text",
38
- "primaryKey": false,
39
- "notNull": true
40
- },
41
- "default_model": {
42
- "name": "default_model",
43
- "type": "text",
44
- "primaryKey": false,
45
- "notNull": true
46
- },
47
- "max_steps": {
48
- "name": "max_steps",
49
- "type": "integer",
50
- "primaryKey": false,
51
- "notNull": true
52
- },
53
- "context_window_size": {
54
- "name": "context_window_size",
55
- "type": "integer",
56
- "primaryKey": false,
57
- "notNull": true
58
- },
59
- "tools": {
60
- "name": "tools",
61
- "type": "jsonb",
62
- "primaryKey": false,
63
- "notNull": true,
64
- "default": "'[]'::jsonb"
65
- },
66
- "base_path": {
67
- "name": "base_path",
68
- "type": "text",
69
- "primaryKey": false,
70
- "notNull": true
71
- },
72
- "is_active": {
73
- "name": "is_active",
74
- "type": "boolean",
75
- "primaryKey": false,
76
- "notNull": true,
77
- "default": true
78
- },
79
- "suggestions": {
80
- "name": "suggestions",
81
- "type": "jsonb",
82
- "primaryKey": false,
83
- "notNull": true,
84
- "default": "'[]'::jsonb"
85
- },
86
- "is_system": {
87
- "name": "is_system",
88
- "type": "boolean",
89
- "primaryKey": false,
90
- "notNull": true,
91
- "default": true
92
- },
93
- "created_at": {
94
- "name": "created_at",
95
- "type": "timestamp",
96
- "primaryKey": false,
97
- "notNull": true,
98
- "default": "now()"
99
- },
100
- "updated_at": {
101
- "name": "updated_at",
102
- "type": "timestamp",
103
- "primaryKey": false,
104
- "notNull": true,
105
- "default": "now()"
106
- }
107
- },
108
- "indexes": {},
109
- "foreignKeys": {},
110
- "compositePrimaryKeys": {},
111
- "uniqueConstraints": {},
112
- "policies": {},
113
- "checkConstraints": {},
114
- "isRLSEnabled": false
115
- },
116
- "public.conversations": {
117
- "name": "conversations",
118
- "schema": "",
119
- "columns": {
120
- "id": {
121
- "name": "id",
122
- "type": "text",
123
- "primaryKey": true,
124
- "notNull": true
125
- },
126
- "workspace_id": {
127
- "name": "workspace_id",
128
- "type": "text",
129
- "primaryKey": false,
130
- "notNull": true
131
- },
132
- "user_id": {
133
- "name": "user_id",
134
- "type": "text",
135
- "primaryKey": false,
136
- "notNull": true
137
- },
138
- "agent_id": {
139
- "name": "agent_id",
140
- "type": "text",
141
- "primaryKey": false,
142
- "notNull": true
143
- },
144
- "title": {
145
- "name": "title",
146
- "type": "text",
147
- "primaryKey": false,
148
- "notNull": false
149
- },
150
- "model_id": {
151
- "name": "model_id",
152
- "type": "text",
153
- "primaryKey": false,
154
- "notNull": false
155
- },
156
- "visibility": {
157
- "name": "visibility",
158
- "type": "text",
159
- "primaryKey": false,
160
- "notNull": true,
161
- "default": "'private'"
162
- },
163
- "metadata": {
164
- "name": "metadata",
165
- "type": "text",
166
- "primaryKey": false,
167
- "notNull": false
168
- },
169
- "created_at": {
170
- "name": "created_at",
171
- "type": "timestamp",
172
- "primaryKey": false,
173
- "notNull": true,
174
- "default": "now()"
175
- },
176
- "updated_at": {
177
- "name": "updated_at",
178
- "type": "timestamp",
179
- "primaryKey": false,
180
- "notNull": true,
181
- "default": "now()"
182
- }
183
- },
184
- "indexes": {
185
- "conversations_workspace_id_idx": {
186
- "name": "conversations_workspace_id_idx",
187
- "columns": [
188
- {
189
- "expression": "workspace_id",
190
- "isExpression": false,
191
- "asc": true,
192
- "nulls": "last"
193
- }
194
- ],
195
- "isUnique": false,
196
- "concurrently": false,
197
- "method": "btree",
198
- "with": {}
199
- },
200
- "conversations_user_id_idx": {
201
- "name": "conversations_user_id_idx",
202
- "columns": [
203
- {
204
- "expression": "user_id",
205
- "isExpression": false,
206
- "asc": true,
207
- "nulls": "last"
208
- }
209
- ],
210
- "isUnique": false,
211
- "concurrently": false,
212
- "method": "btree",
213
- "with": {}
214
- },
215
- "conversations_workspace_updated_idx": {
216
- "name": "conversations_workspace_updated_idx",
217
- "columns": [
218
- {
219
- "expression": "workspace_id",
220
- "isExpression": false,
221
- "asc": true,
222
- "nulls": "last"
223
- },
224
- {
225
- "expression": "updated_at",
226
- "isExpression": false,
227
- "asc": true,
228
- "nulls": "last"
229
- }
230
- ],
231
- "isUnique": false,
232
- "concurrently": false,
233
- "method": "btree",
234
- "with": {}
235
- }
236
- },
237
- "foreignKeys": {
238
- "conversations_workspace_id_organization_id_fk": {
239
- "name": "conversations_workspace_id_organization_id_fk",
240
- "tableFrom": "conversations",
241
- "tableTo": "organization",
242
- "columnsFrom": ["workspace_id"],
243
- "columnsTo": ["id"],
244
- "onDelete": "cascade",
245
- "onUpdate": "no action"
246
- },
247
- "conversations_user_id_users_id_fk": {
248
- "name": "conversations_user_id_users_id_fk",
249
- "tableFrom": "conversations",
250
- "tableTo": "users",
251
- "columnsFrom": ["user_id"],
252
- "columnsTo": ["id"],
253
- "onDelete": "cascade",
254
- "onUpdate": "no action"
255
- }
256
- },
257
- "compositePrimaryKeys": {},
258
- "uniqueConstraints": {},
259
- "policies": {},
260
- "checkConstraints": {},
261
- "isRLSEnabled": false
262
- },
263
- "public.documents": {
264
- "name": "documents",
265
- "schema": "",
266
- "columns": {
267
- "id": {
268
- "name": "id",
269
- "type": "text",
270
- "primaryKey": false,
271
- "notNull": true
272
- },
273
- "created_at": {
274
- "name": "created_at",
275
- "type": "timestamp",
276
- "primaryKey": false,
277
- "notNull": true,
278
- "default": "now()"
279
- },
280
- "title": {
281
- "name": "title",
282
- "type": "text",
283
- "primaryKey": false,
284
- "notNull": true
285
- },
286
- "content": {
287
- "name": "content",
288
- "type": "text",
289
- "primaryKey": false,
290
- "notNull": false
291
- },
292
- "kind": {
293
- "name": "kind",
294
- "type": "text",
295
- "primaryKey": false,
296
- "notNull": true,
297
- "default": "'text'"
298
- },
299
- "user_id": {
300
- "name": "user_id",
301
- "type": "text",
302
- "primaryKey": false,
303
- "notNull": true
304
- }
305
- },
306
- "indexes": {},
307
- "foreignKeys": {
308
- "documents_user_id_users_id_fk": {
309
- "name": "documents_user_id_users_id_fk",
310
- "tableFrom": "documents",
311
- "tableTo": "users",
312
- "columnsFrom": ["user_id"],
313
- "columnsTo": ["id"],
314
- "onDelete": "cascade",
315
- "onUpdate": "no action"
316
- }
317
- },
318
- "compositePrimaryKeys": {
319
- "documents_id_created_at_pk": {
320
- "name": "documents_id_created_at_pk",
321
- "columns": ["id", "created_at"]
322
- }
323
- },
324
- "uniqueConstraints": {},
325
- "policies": {},
326
- "checkConstraints": {},
327
- "isRLSEnabled": false
328
- },
329
- "public.knowledge_chunks": {
330
- "name": "knowledge_chunks",
331
- "schema": "",
332
- "columns": {
333
- "id": {
334
- "name": "id",
335
- "type": "text",
336
- "primaryKey": true,
337
- "notNull": true
338
- },
339
- "document_id": {
340
- "name": "document_id",
341
- "type": "text",
342
- "primaryKey": false,
343
- "notNull": true
344
- },
345
- "workspace_id": {
346
- "name": "workspace_id",
347
- "type": "text",
348
- "primaryKey": false,
349
- "notNull": true
350
- },
351
- "content": {
352
- "name": "content",
353
- "type": "text",
354
- "primaryKey": false,
355
- "notNull": true
356
- },
357
- "embedding": {
358
- "name": "embedding",
359
- "type": "vector(1536)",
360
- "primaryKey": false,
361
- "notNull": false
362
- },
363
- "metadata": {
364
- "name": "metadata",
365
- "type": "text",
366
- "primaryKey": false,
367
- "notNull": false
368
- },
369
- "chunk_index": {
370
- "name": "chunk_index",
371
- "type": "integer",
372
- "primaryKey": false,
373
- "notNull": true
374
- },
375
- "created_at": {
376
- "name": "created_at",
377
- "type": "timestamp",
378
- "primaryKey": false,
379
- "notNull": true,
380
- "default": "now()"
381
- }
382
- },
383
- "indexes": {
384
- "knowledge_chunks_document_id_idx": {
385
- "name": "knowledge_chunks_document_id_idx",
386
- "columns": [
387
- {
388
- "expression": "document_id",
389
- "isExpression": false,
390
- "asc": true,
391
- "nulls": "last"
392
- }
393
- ],
394
- "isUnique": false,
395
- "concurrently": false,
396
- "method": "btree",
397
- "with": {}
398
- },
399
- "knowledge_chunks_workspace_id_idx": {
400
- "name": "knowledge_chunks_workspace_id_idx",
401
- "columns": [
402
- {
403
- "expression": "workspace_id",
404
- "isExpression": false,
405
- "asc": true,
406
- "nulls": "last"
407
- }
408
- ],
409
- "isUnique": false,
410
- "concurrently": false,
411
- "method": "btree",
412
- "with": {}
413
- }
414
- },
415
- "foreignKeys": {
416
- "knowledge_chunks_document_id_knowledge_documents_id_fk": {
417
- "name": "knowledge_chunks_document_id_knowledge_documents_id_fk",
418
- "tableFrom": "knowledge_chunks",
419
- "tableTo": "knowledge_documents",
420
- "columnsFrom": ["document_id"],
421
- "columnsTo": ["id"],
422
- "onDelete": "cascade",
423
- "onUpdate": "no action"
424
- },
425
- "knowledge_chunks_workspace_id_organization_id_fk": {
426
- "name": "knowledge_chunks_workspace_id_organization_id_fk",
427
- "tableFrom": "knowledge_chunks",
428
- "tableTo": "organization",
429
- "columnsFrom": ["workspace_id"],
430
- "columnsTo": ["id"],
431
- "onDelete": "cascade",
432
- "onUpdate": "no action"
433
- }
434
- },
435
- "compositePrimaryKeys": {},
436
- "uniqueConstraints": {},
437
- "policies": {},
438
- "checkConstraints": {},
439
- "isRLSEnabled": false
440
- },
441
- "public.knowledge_documents": {
442
- "name": "knowledge_documents",
443
- "schema": "",
444
- "columns": {
445
- "id": {
446
- "name": "id",
447
- "type": "text",
448
- "primaryKey": true,
449
- "notNull": true
450
- },
451
- "workspace_id": {
452
- "name": "workspace_id",
453
- "type": "text",
454
- "primaryKey": false,
455
- "notNull": true
456
- },
457
- "filename": {
458
- "name": "filename",
459
- "type": "text",
460
- "primaryKey": false,
461
- "notNull": true
462
- },
463
- "mime_type": {
464
- "name": "mime_type",
465
- "type": "text",
466
- "primaryKey": false,
467
- "notNull": true
468
- },
469
- "size_bytes": {
470
- "name": "size_bytes",
471
- "type": "integer",
472
- "primaryKey": false,
473
- "notNull": false
474
- },
475
- "chunk_count": {
476
- "name": "chunk_count",
477
- "type": "integer",
478
- "primaryKey": false,
479
- "notNull": false,
480
- "default": 0
481
- },
482
- "status": {
483
- "name": "status",
484
- "type": "text",
485
- "primaryKey": false,
486
- "notNull": true,
487
- "default": "'processing'"
488
- },
489
- "product": {
490
- "name": "product",
491
- "type": "text",
492
- "primaryKey": false,
493
- "notNull": false
494
- },
495
- "metadata": {
496
- "name": "metadata",
497
- "type": "text",
498
- "primaryKey": false,
499
- "notNull": false
500
- },
501
- "created_at": {
502
- "name": "created_at",
503
- "type": "timestamp",
504
- "primaryKey": false,
505
- "notNull": true,
506
- "default": "now()"
507
- }
508
- },
509
- "indexes": {
510
- "knowledge_documents_workspace_id_idx": {
511
- "name": "knowledge_documents_workspace_id_idx",
512
- "columns": [
513
- {
514
- "expression": "workspace_id",
515
- "isExpression": false,
516
- "asc": true,
517
- "nulls": "last"
518
- }
519
- ],
520
- "isUnique": false,
521
- "concurrently": false,
522
- "method": "btree",
523
- "with": {}
524
- }
525
- },
526
- "foreignKeys": {
527
- "knowledge_documents_workspace_id_organization_id_fk": {
528
- "name": "knowledge_documents_workspace_id_organization_id_fk",
529
- "tableFrom": "knowledge_documents",
530
- "tableTo": "organization",
531
- "columnsFrom": ["workspace_id"],
532
- "columnsTo": ["id"],
533
- "onDelete": "cascade",
534
- "onUpdate": "no action"
535
- }
536
- },
537
- "compositePrimaryKeys": {},
538
- "uniqueConstraints": {},
539
- "policies": {},
540
- "checkConstraints": {},
541
- "isRLSEnabled": false
542
- },
543
- "public.messages": {
544
- "name": "messages",
545
- "schema": "",
546
- "columns": {
547
- "id": {
548
- "name": "id",
549
- "type": "text",
550
- "primaryKey": true,
551
- "notNull": true
552
- },
553
- "conversation_id": {
554
- "name": "conversation_id",
555
- "type": "text",
556
- "primaryKey": false,
557
- "notNull": true
558
- },
559
- "role": {
560
- "name": "role",
561
- "type": "text",
562
- "primaryKey": false,
563
- "notNull": true
564
- },
565
- "content": {
566
- "name": "content",
567
- "type": "text",
568
- "primaryKey": false,
569
- "notNull": false
570
- },
571
- "parts": {
572
- "name": "parts",
573
- "type": "text",
574
- "primaryKey": false,
575
- "notNull": true
576
- },
577
- "attachments": {
578
- "name": "attachments",
579
- "type": "text",
580
- "primaryKey": false,
581
- "notNull": false
582
- },
583
- "tool_invocations": {
584
- "name": "tool_invocations",
585
- "type": "text",
586
- "primaryKey": false,
587
- "notNull": false
588
- },
589
- "token_count": {
590
- "name": "token_count",
591
- "type": "integer",
592
- "primaryKey": false,
593
- "notNull": false
594
- },
595
- "created_at": {
596
- "name": "created_at",
597
- "type": "timestamp",
598
- "primaryKey": false,
599
- "notNull": true,
600
- "default": "now()"
601
- }
602
- },
603
- "indexes": {
604
- "messages_conversation_id_idx": {
605
- "name": "messages_conversation_id_idx",
606
- "columns": [
607
- {
608
- "expression": "conversation_id",
609
- "isExpression": false,
610
- "asc": true,
611
- "nulls": "last"
612
- }
613
- ],
614
- "isUnique": false,
615
- "concurrently": false,
616
- "method": "btree",
617
- "with": {}
618
- },
619
- "messages_conversation_created_idx": {
620
- "name": "messages_conversation_created_idx",
621
- "columns": [
622
- {
623
- "expression": "conversation_id",
624
- "isExpression": false,
625
- "asc": true,
626
- "nulls": "last"
627
- },
628
- {
629
- "expression": "created_at",
630
- "isExpression": false,
631
- "asc": true,
632
- "nulls": "last"
633
- }
634
- ],
635
- "isUnique": false,
636
- "concurrently": false,
637
- "method": "btree",
638
- "with": {}
639
- }
640
- },
641
- "foreignKeys": {
642
- "messages_conversation_id_conversations_id_fk": {
643
- "name": "messages_conversation_id_conversations_id_fk",
644
- "tableFrom": "messages",
645
- "tableTo": "conversations",
646
- "columnsFrom": ["conversation_id"],
647
- "columnsTo": ["id"],
648
- "onDelete": "cascade",
649
- "onUpdate": "no action"
650
- }
651
- },
652
- "compositePrimaryKeys": {},
653
- "uniqueConstraints": {},
654
- "policies": {},
655
- "checkConstraints": {},
656
- "isRLSEnabled": false
657
- },
658
- "public.suggestions": {
659
- "name": "suggestions",
660
- "schema": "",
661
- "columns": {
662
- "id": {
663
- "name": "id",
664
- "type": "text",
665
- "primaryKey": true,
666
- "notNull": true
667
- },
668
- "document_id": {
669
- "name": "document_id",
670
- "type": "text",
671
- "primaryKey": false,
672
- "notNull": true
673
- },
674
- "document_created_at": {
675
- "name": "document_created_at",
676
- "type": "timestamp",
677
- "primaryKey": false,
678
- "notNull": true
679
- },
680
- "original_text": {
681
- "name": "original_text",
682
- "type": "text",
683
- "primaryKey": false,
684
- "notNull": true
685
- },
686
- "suggested_text": {
687
- "name": "suggested_text",
688
- "type": "text",
689
- "primaryKey": false,
690
- "notNull": true
691
- },
692
- "description": {
693
- "name": "description",
694
- "type": "text",
695
- "primaryKey": false,
696
- "notNull": false
697
- },
698
- "is_resolved": {
699
- "name": "is_resolved",
700
- "type": "boolean",
701
- "primaryKey": false,
702
- "notNull": true,
703
- "default": false
704
- },
705
- "user_id": {
706
- "name": "user_id",
707
- "type": "text",
708
- "primaryKey": false,
709
- "notNull": true
710
- },
711
- "created_at": {
712
- "name": "created_at",
713
- "type": "timestamp",
714
- "primaryKey": false,
715
- "notNull": true,
716
- "default": "now()"
717
- }
718
- },
719
- "indexes": {},
720
- "foreignKeys": {
721
- "suggestions_user_id_users_id_fk": {
722
- "name": "suggestions_user_id_users_id_fk",
723
- "tableFrom": "suggestions",
724
- "tableTo": "users",
725
- "columnsFrom": ["user_id"],
726
- "columnsTo": ["id"],
727
- "onDelete": "cascade",
728
- "onUpdate": "no action"
729
- }
730
- },
731
- "compositePrimaryKeys": {},
732
- "uniqueConstraints": {},
733
- "policies": {},
734
- "checkConstraints": {},
735
- "isRLSEnabled": false
736
- },
737
- "public.votes": {
738
- "name": "votes",
739
- "schema": "",
740
- "columns": {
741
- "chat_id": {
742
- "name": "chat_id",
743
- "type": "text",
744
- "primaryKey": false,
745
- "notNull": true
746
- },
747
- "message_id": {
748
- "name": "message_id",
749
- "type": "text",
750
- "primaryKey": false,
751
- "notNull": true
752
- },
753
- "is_upvoted": {
754
- "name": "is_upvoted",
755
- "type": "boolean",
756
- "primaryKey": false,
757
- "notNull": true
758
- }
759
- },
760
- "indexes": {},
761
- "foreignKeys": {
762
- "votes_chat_id_conversations_id_fk": {
763
- "name": "votes_chat_id_conversations_id_fk",
764
- "tableFrom": "votes",
765
- "tableTo": "conversations",
766
- "columnsFrom": ["chat_id"],
767
- "columnsTo": ["id"],
768
- "onDelete": "cascade",
769
- "onUpdate": "no action"
770
- },
771
- "votes_message_id_messages_id_fk": {
772
- "name": "votes_message_id_messages_id_fk",
773
- "tableFrom": "votes",
774
- "tableTo": "messages",
775
- "columnsFrom": ["message_id"],
776
- "columnsTo": ["id"],
777
- "onDelete": "cascade",
778
- "onUpdate": "no action"
779
- }
780
- },
781
- "compositePrimaryKeys": {
782
- "votes_chat_id_message_id_pk": {
783
- "name": "votes_chat_id_message_id_pk",
784
- "columns": ["chat_id", "message_id"]
785
- }
786
- },
787
- "uniqueConstraints": {},
788
- "policies": {},
789
- "checkConstraints": {},
790
- "isRLSEnabled": false
791
- },
792
- "public.accounts": {
793
- "name": "accounts",
794
- "schema": "",
795
- "columns": {
796
- "id": {
797
- "name": "id",
798
- "type": "text",
799
- "primaryKey": true,
800
- "notNull": true
801
- },
802
- "user_id": {
803
- "name": "user_id",
804
- "type": "text",
805
- "primaryKey": false,
806
- "notNull": true
807
- },
808
- "account_id": {
809
- "name": "account_id",
810
- "type": "text",
811
- "primaryKey": false,
812
- "notNull": true
813
- },
814
- "provider_id": {
815
- "name": "provider_id",
816
- "type": "text",
817
- "primaryKey": false,
818
- "notNull": true
819
- },
820
- "access_token": {
821
- "name": "access_token",
822
- "type": "text",
823
- "primaryKey": false,
824
- "notNull": false
825
- },
826
- "refresh_token": {
827
- "name": "refresh_token",
828
- "type": "text",
829
- "primaryKey": false,
830
- "notNull": false
831
- },
832
- "access_token_expires_at": {
833
- "name": "access_token_expires_at",
834
- "type": "timestamp",
835
- "primaryKey": false,
836
- "notNull": false
837
- },
838
- "refresh_token_expires_at": {
839
- "name": "refresh_token_expires_at",
840
- "type": "timestamp",
841
- "primaryKey": false,
842
- "notNull": false
843
- },
844
- "scope": {
845
- "name": "scope",
846
- "type": "text",
847
- "primaryKey": false,
848
- "notNull": false
849
- },
850
- "id_token": {
851
- "name": "id_token",
852
- "type": "text",
853
- "primaryKey": false,
854
- "notNull": false
855
- },
856
- "password": {
857
- "name": "password",
858
- "type": "text",
859
- "primaryKey": false,
860
- "notNull": false
861
- },
862
- "created_at": {
863
- "name": "created_at",
864
- "type": "timestamp",
865
- "primaryKey": false,
866
- "notNull": true,
867
- "default": "now()"
868
- },
869
- "updated_at": {
870
- "name": "updated_at",
871
- "type": "timestamp",
872
- "primaryKey": false,
873
- "notNull": true,
874
- "default": "now()"
875
- }
876
- },
877
- "indexes": {
878
- "accounts_user_id_idx": {
879
- "name": "accounts_user_id_idx",
880
- "columns": [
881
- {
882
- "expression": "user_id",
883
- "isExpression": false,
884
- "asc": true,
885
- "nulls": "last"
886
- }
887
- ],
888
- "isUnique": false,
889
- "concurrently": false,
890
- "method": "btree",
891
- "with": {}
892
- }
893
- },
894
- "foreignKeys": {
895
- "accounts_user_id_users_id_fk": {
896
- "name": "accounts_user_id_users_id_fk",
897
- "tableFrom": "accounts",
898
- "tableTo": "users",
899
- "columnsFrom": ["user_id"],
900
- "columnsTo": ["id"],
901
- "onDelete": "cascade",
902
- "onUpdate": "no action"
903
- }
904
- },
905
- "compositePrimaryKeys": {},
906
- "uniqueConstraints": {},
907
- "policies": {},
908
- "checkConstraints": {},
909
- "isRLSEnabled": false
910
- },
911
- "public.invitation": {
912
- "name": "invitation",
913
- "schema": "",
914
- "columns": {
915
- "id": {
916
- "name": "id",
917
- "type": "text",
918
- "primaryKey": true,
919
- "notNull": true
920
- },
921
- "organization_id": {
922
- "name": "organization_id",
923
- "type": "text",
924
- "primaryKey": false,
925
- "notNull": true
926
- },
927
- "email": {
928
- "name": "email",
929
- "type": "text",
930
- "primaryKey": false,
931
- "notNull": true
932
- },
933
- "role": {
934
- "name": "role",
935
- "type": "text",
936
- "primaryKey": false,
937
- "notNull": true
938
- },
939
- "status": {
940
- "name": "status",
941
- "type": "text",
942
- "primaryKey": false,
943
- "notNull": true
944
- },
945
- "expires_at": {
946
- "name": "expires_at",
947
- "type": "timestamp",
948
- "primaryKey": false,
949
- "notNull": true
950
- },
951
- "inviter_id": {
952
- "name": "inviter_id",
953
- "type": "text",
954
- "primaryKey": false,
955
- "notNull": true
956
- },
957
- "created_at": {
958
- "name": "created_at",
959
- "type": "timestamp",
960
- "primaryKey": false,
961
- "notNull": true,
962
- "default": "now()"
963
- },
964
- "updated_at": {
965
- "name": "updated_at",
966
- "type": "timestamp",
967
- "primaryKey": false,
968
- "notNull": true,
969
- "default": "now()"
970
- }
971
- },
972
- "indexes": {
973
- "invitation_organization_id_idx": {
974
- "name": "invitation_organization_id_idx",
975
- "columns": [
976
- {
977
- "expression": "organization_id",
978
- "isExpression": false,
979
- "asc": true,
980
- "nulls": "last"
981
- }
982
- ],
983
- "isUnique": false,
984
- "concurrently": false,
985
- "method": "btree",
986
- "with": {}
987
- },
988
- "invitation_email_idx": {
989
- "name": "invitation_email_idx",
990
- "columns": [
991
- {
992
- "expression": "email",
993
- "isExpression": false,
994
- "asc": true,
995
- "nulls": "last"
996
- }
997
- ],
998
- "isUnique": false,
999
- "concurrently": false,
1000
- "method": "btree",
1001
- "with": {}
1002
- }
1003
- },
1004
- "foreignKeys": {
1005
- "invitation_organization_id_organization_id_fk": {
1006
- "name": "invitation_organization_id_organization_id_fk",
1007
- "tableFrom": "invitation",
1008
- "tableTo": "organization",
1009
- "columnsFrom": ["organization_id"],
1010
- "columnsTo": ["id"],
1011
- "onDelete": "cascade",
1012
- "onUpdate": "no action"
1013
- },
1014
- "invitation_inviter_id_users_id_fk": {
1015
- "name": "invitation_inviter_id_users_id_fk",
1016
- "tableFrom": "invitation",
1017
- "tableTo": "users",
1018
- "columnsFrom": ["inviter_id"],
1019
- "columnsTo": ["id"],
1020
- "onDelete": "no action",
1021
- "onUpdate": "no action"
1022
- }
1023
- },
1024
- "compositePrimaryKeys": {},
1025
- "uniqueConstraints": {},
1026
- "policies": {},
1027
- "checkConstraints": {},
1028
- "isRLSEnabled": false
1029
- },
1030
- "public.member": {
1031
- "name": "member",
1032
- "schema": "",
1033
- "columns": {
1034
- "id": {
1035
- "name": "id",
1036
- "type": "text",
1037
- "primaryKey": true,
1038
- "notNull": true
1039
- },
1040
- "organization_id": {
1041
- "name": "organization_id",
1042
- "type": "text",
1043
- "primaryKey": false,
1044
- "notNull": true
1045
- },
1046
- "user_id": {
1047
- "name": "user_id",
1048
- "type": "text",
1049
- "primaryKey": false,
1050
- "notNull": true
1051
- },
1052
- "role": {
1053
- "name": "role",
1054
- "type": "text",
1055
- "primaryKey": false,
1056
- "notNull": true
1057
- },
1058
- "created_at": {
1059
- "name": "created_at",
1060
- "type": "timestamp",
1061
- "primaryKey": false,
1062
- "notNull": true,
1063
- "default": "now()"
1064
- },
1065
- "updated_at": {
1066
- "name": "updated_at",
1067
- "type": "timestamp",
1068
- "primaryKey": false,
1069
- "notNull": true,
1070
- "default": "now()"
1071
- }
1072
- },
1073
- "indexes": {
1074
- "member_organization_id_idx": {
1075
- "name": "member_organization_id_idx",
1076
- "columns": [
1077
- {
1078
- "expression": "organization_id",
1079
- "isExpression": false,
1080
- "asc": true,
1081
- "nulls": "last"
1082
- }
1083
- ],
1084
- "isUnique": false,
1085
- "concurrently": false,
1086
- "method": "btree",
1087
- "with": {}
1088
- },
1089
- "member_user_id_idx": {
1090
- "name": "member_user_id_idx",
1091
- "columns": [
1092
- {
1093
- "expression": "user_id",
1094
- "isExpression": false,
1095
- "asc": true,
1096
- "nulls": "last"
1097
- }
1098
- ],
1099
- "isUnique": false,
1100
- "concurrently": false,
1101
- "method": "btree",
1102
- "with": {}
1103
- }
1104
- },
1105
- "foreignKeys": {
1106
- "member_organization_id_organization_id_fk": {
1107
- "name": "member_organization_id_organization_id_fk",
1108
- "tableFrom": "member",
1109
- "tableTo": "organization",
1110
- "columnsFrom": ["organization_id"],
1111
- "columnsTo": ["id"],
1112
- "onDelete": "cascade",
1113
- "onUpdate": "no action"
1114
- },
1115
- "member_user_id_users_id_fk": {
1116
- "name": "member_user_id_users_id_fk",
1117
- "tableFrom": "member",
1118
- "tableTo": "users",
1119
- "columnsFrom": ["user_id"],
1120
- "columnsTo": ["id"],
1121
- "onDelete": "cascade",
1122
- "onUpdate": "no action"
1123
- }
1124
- },
1125
- "compositePrimaryKeys": {},
1126
- "uniqueConstraints": {},
1127
- "policies": {},
1128
- "checkConstraints": {},
1129
- "isRLSEnabled": false
1130
- },
1131
- "public.organization": {
1132
- "name": "organization",
1133
- "schema": "",
1134
- "columns": {
1135
- "id": {
1136
- "name": "id",
1137
- "type": "text",
1138
- "primaryKey": true,
1139
- "notNull": true
1140
- },
1141
- "name": {
1142
- "name": "name",
1143
- "type": "text",
1144
- "primaryKey": false,
1145
- "notNull": true
1146
- },
1147
- "slug": {
1148
- "name": "slug",
1149
- "type": "text",
1150
- "primaryKey": false,
1151
- "notNull": false
1152
- },
1153
- "logo": {
1154
- "name": "logo",
1155
- "type": "text",
1156
- "primaryKey": false,
1157
- "notNull": false
1158
- },
1159
- "metadata": {
1160
- "name": "metadata",
1161
- "type": "text",
1162
- "primaryKey": false,
1163
- "notNull": false
1164
- },
1165
- "created_at": {
1166
- "name": "created_at",
1167
- "type": "timestamp",
1168
- "primaryKey": false,
1169
- "notNull": true,
1170
- "default": "now()"
1171
- },
1172
- "updated_at": {
1173
- "name": "updated_at",
1174
- "type": "timestamp",
1175
- "primaryKey": false,
1176
- "notNull": true,
1177
- "default": "now()"
1178
- }
1179
- },
1180
- "indexes": {},
1181
- "foreignKeys": {},
1182
- "compositePrimaryKeys": {},
1183
- "uniqueConstraints": {
1184
- "organization_slug_unique": {
1185
- "name": "organization_slug_unique",
1186
- "nullsNotDistinct": false,
1187
- "columns": ["slug"]
1188
- }
1189
- },
1190
- "policies": {},
1191
- "checkConstraints": {},
1192
- "isRLSEnabled": false
1193
- },
1194
- "public.sessions": {
1195
- "name": "sessions",
1196
- "schema": "",
1197
- "columns": {
1198
- "id": {
1199
- "name": "id",
1200
- "type": "text",
1201
- "primaryKey": true,
1202
- "notNull": true
1203
- },
1204
- "user_id": {
1205
- "name": "user_id",
1206
- "type": "text",
1207
- "primaryKey": false,
1208
- "notNull": true
1209
- },
1210
- "token": {
1211
- "name": "token",
1212
- "type": "text",
1213
- "primaryKey": false,
1214
- "notNull": true
1215
- },
1216
- "expires_at": {
1217
- "name": "expires_at",
1218
- "type": "timestamp",
1219
- "primaryKey": false,
1220
- "notNull": true
1221
- },
1222
- "ip_address": {
1223
- "name": "ip_address",
1224
- "type": "text",
1225
- "primaryKey": false,
1226
- "notNull": false
1227
- },
1228
- "user_agent": {
1229
- "name": "user_agent",
1230
- "type": "text",
1231
- "primaryKey": false,
1232
- "notNull": false
1233
- },
1234
- "created_at": {
1235
- "name": "created_at",
1236
- "type": "timestamp",
1237
- "primaryKey": false,
1238
- "notNull": true,
1239
- "default": "now()"
1240
- },
1241
- "updated_at": {
1242
- "name": "updated_at",
1243
- "type": "timestamp",
1244
- "primaryKey": false,
1245
- "notNull": true,
1246
- "default": "now()"
1247
- }
1248
- },
1249
- "indexes": {
1250
- "sessions_user_id_idx": {
1251
- "name": "sessions_user_id_idx",
1252
- "columns": [
1253
- {
1254
- "expression": "user_id",
1255
- "isExpression": false,
1256
- "asc": true,
1257
- "nulls": "last"
1258
- }
1259
- ],
1260
- "isUnique": false,
1261
- "concurrently": false,
1262
- "method": "btree",
1263
- "with": {}
1264
- }
1265
- },
1266
- "foreignKeys": {
1267
- "sessions_user_id_users_id_fk": {
1268
- "name": "sessions_user_id_users_id_fk",
1269
- "tableFrom": "sessions",
1270
- "tableTo": "users",
1271
- "columnsFrom": ["user_id"],
1272
- "columnsTo": ["id"],
1273
- "onDelete": "cascade",
1274
- "onUpdate": "no action"
1275
- }
1276
- },
1277
- "compositePrimaryKeys": {},
1278
- "uniqueConstraints": {
1279
- "sessions_token_unique": {
1280
- "name": "sessions_token_unique",
1281
- "nullsNotDistinct": false,
1282
- "columns": ["token"]
1283
- }
1284
- },
1285
- "policies": {},
1286
- "checkConstraints": {},
1287
- "isRLSEnabled": false
1288
- },
1289
- "public.users": {
1290
- "name": "users",
1291
- "schema": "",
1292
- "columns": {
1293
- "id": {
1294
- "name": "id",
1295
- "type": "text",
1296
- "primaryKey": true,
1297
- "notNull": true
1298
- },
1299
- "name": {
1300
- "name": "name",
1301
- "type": "text",
1302
- "primaryKey": false,
1303
- "notNull": true
1304
- },
1305
- "email": {
1306
- "name": "email",
1307
- "type": "text",
1308
- "primaryKey": false,
1309
- "notNull": true
1310
- },
1311
- "email_verified": {
1312
- "name": "email_verified",
1313
- "type": "boolean",
1314
- "primaryKey": false,
1315
- "notNull": true,
1316
- "default": false
1317
- },
1318
- "image": {
1319
- "name": "image",
1320
- "type": "text",
1321
- "primaryKey": false,
1322
- "notNull": false
1323
- },
1324
- "deleted_at": {
1325
- "name": "deleted_at",
1326
- "type": "timestamp",
1327
- "primaryKey": false,
1328
- "notNull": false
1329
- },
1330
- "created_at": {
1331
- "name": "created_at",
1332
- "type": "timestamp",
1333
- "primaryKey": false,
1334
- "notNull": true,
1335
- "default": "now()"
1336
- },
1337
- "updated_at": {
1338
- "name": "updated_at",
1339
- "type": "timestamp",
1340
- "primaryKey": false,
1341
- "notNull": true,
1342
- "default": "now()"
1343
- },
1344
- "onboarding_completed": {
1345
- "name": "onboarding_completed",
1346
- "type": "boolean",
1347
- "primaryKey": false,
1348
- "notNull": true,
1349
- "default": false
1350
- },
1351
- "onboarding_step": {
1352
- "name": "onboarding_step",
1353
- "type": "text",
1354
- "primaryKey": false,
1355
- "notNull": false
1356
- },
1357
- "preferred_language": {
1358
- "name": "preferred_language",
1359
- "type": "text",
1360
- "primaryKey": false,
1361
- "notNull": true,
1362
- "default": "'en'"
1363
- }
1364
- },
1365
- "indexes": {},
1366
- "foreignKeys": {},
1367
- "compositePrimaryKeys": {},
1368
- "uniqueConstraints": {
1369
- "users_email_unique": {
1370
- "name": "users_email_unique",
1371
- "nullsNotDistinct": false,
1372
- "columns": ["email"]
1373
- }
1374
- },
1375
- "policies": {},
1376
- "checkConstraints": {},
1377
- "isRLSEnabled": false
1378
- },
1379
- "public.verifications": {
1380
- "name": "verifications",
1381
- "schema": "",
1382
- "columns": {
1383
- "id": {
1384
- "name": "id",
1385
- "type": "text",
1386
- "primaryKey": true,
1387
- "notNull": true
1388
- },
1389
- "identifier": {
1390
- "name": "identifier",
1391
- "type": "text",
1392
- "primaryKey": false,
1393
- "notNull": true
1394
- },
1395
- "value": {
1396
- "name": "value",
1397
- "type": "text",
1398
- "primaryKey": false,
1399
- "notNull": true
1400
- },
1401
- "expires_at": {
1402
- "name": "expires_at",
1403
- "type": "timestamp",
1404
- "primaryKey": false,
1405
- "notNull": true
1406
- },
1407
- "created_at": {
1408
- "name": "created_at",
1409
- "type": "timestamp",
1410
- "primaryKey": false,
1411
- "notNull": true,
1412
- "default": "now()"
1413
- },
1414
- "updated_at": {
1415
- "name": "updated_at",
1416
- "type": "timestamp",
1417
- "primaryKey": false,
1418
- "notNull": true,
1419
- "default": "now()"
1420
- }
1421
- },
1422
- "indexes": {},
1423
- "foreignKeys": {},
1424
- "compositePrimaryKeys": {},
1425
- "uniqueConstraints": {},
1426
- "policies": {},
1427
- "checkConstraints": {},
1428
- "isRLSEnabled": false
1429
- },
1430
- "public.credit_balances": {
1431
- "name": "credit_balances",
1432
- "schema": "",
1433
- "columns": {
1434
- "id": {
1435
- "name": "id",
1436
- "type": "text",
1437
- "primaryKey": true,
1438
- "notNull": true
1439
- },
1440
- "workspace_id": {
1441
- "name": "workspace_id",
1442
- "type": "text",
1443
- "primaryKey": false,
1444
- "notNull": true
1445
- },
1446
- "balance": {
1447
- "name": "balance",
1448
- "type": "integer",
1449
- "primaryKey": false,
1450
- "notNull": true,
1451
- "default": 0
1452
- },
1453
- "total_purchased": {
1454
- "name": "total_purchased",
1455
- "type": "integer",
1456
- "primaryKey": false,
1457
- "notNull": true,
1458
- "default": 0
1459
- },
1460
- "total_used": {
1461
- "name": "total_used",
1462
- "type": "integer",
1463
- "primaryKey": false,
1464
- "notNull": true,
1465
- "default": 0
1466
- },
1467
- "updated_at": {
1468
- "name": "updated_at",
1469
- "type": "timestamp",
1470
- "primaryKey": false,
1471
- "notNull": true,
1472
- "default": "now()"
1473
- }
1474
- },
1475
- "indexes": {},
1476
- "foreignKeys": {
1477
- "credit_balances_workspace_id_organization_id_fk": {
1478
- "name": "credit_balances_workspace_id_organization_id_fk",
1479
- "tableFrom": "credit_balances",
1480
- "tableTo": "organization",
1481
- "columnsFrom": ["workspace_id"],
1482
- "columnsTo": ["id"],
1483
- "onDelete": "cascade",
1484
- "onUpdate": "no action"
1485
- }
1486
- },
1487
- "compositePrimaryKeys": {},
1488
- "uniqueConstraints": {
1489
- "credit_balances_workspace_id_unique": {
1490
- "name": "credit_balances_workspace_id_unique",
1491
- "nullsNotDistinct": false,
1492
- "columns": ["workspace_id"]
1493
- }
1494
- },
1495
- "policies": {},
1496
- "checkConstraints": {},
1497
- "isRLSEnabled": false
1498
- },
1499
- "public.credit_purchases": {
1500
- "name": "credit_purchases",
1501
- "schema": "",
1502
- "columns": {
1503
- "id": {
1504
- "name": "id",
1505
- "type": "text",
1506
- "primaryKey": true,
1507
- "notNull": true
1508
- },
1509
- "workspace_id": {
1510
- "name": "workspace_id",
1511
- "type": "text",
1512
- "primaryKey": false,
1513
- "notNull": true
1514
- },
1515
- "amount": {
1516
- "name": "amount",
1517
- "type": "integer",
1518
- "primaryKey": false,
1519
- "notNull": true
1520
- },
1521
- "credits": {
1522
- "name": "credits",
1523
- "type": "integer",
1524
- "primaryKey": false,
1525
- "notNull": true
1526
- },
1527
- "stripe_payment_intent_id": {
1528
- "name": "stripe_payment_intent_id",
1529
- "type": "text",
1530
- "primaryKey": false,
1531
- "notNull": false
1532
- },
1533
- "stripe_checkout_session_id": {
1534
- "name": "stripe_checkout_session_id",
1535
- "type": "text",
1536
- "primaryKey": false,
1537
- "notNull": false
1538
- },
1539
- "status": {
1540
- "name": "status",
1541
- "type": "text",
1542
- "primaryKey": false,
1543
- "notNull": true,
1544
- "default": "'pending'"
1545
- },
1546
- "created_at": {
1547
- "name": "created_at",
1548
- "type": "timestamp",
1549
- "primaryKey": false,
1550
- "notNull": true,
1551
- "default": "now()"
1552
- }
1553
- },
1554
- "indexes": {
1555
- "credit_purchases_workspace_id_idx": {
1556
- "name": "credit_purchases_workspace_id_idx",
1557
- "columns": [
1558
- {
1559
- "expression": "workspace_id",
1560
- "isExpression": false,
1561
- "asc": true,
1562
- "nulls": "last"
1563
- }
1564
- ],
1565
- "isUnique": false,
1566
- "concurrently": false,
1567
- "method": "btree",
1568
- "with": {}
1569
- }
1570
- },
1571
- "foreignKeys": {
1572
- "credit_purchases_workspace_id_organization_id_fk": {
1573
- "name": "credit_purchases_workspace_id_organization_id_fk",
1574
- "tableFrom": "credit_purchases",
1575
- "tableTo": "organization",
1576
- "columnsFrom": ["workspace_id"],
1577
- "columnsTo": ["id"],
1578
- "onDelete": "cascade",
1579
- "onUpdate": "no action"
1580
- }
1581
- },
1582
- "compositePrimaryKeys": {},
1583
- "uniqueConstraints": {},
1584
- "policies": {},
1585
- "checkConstraints": {},
1586
- "isRLSEnabled": false
1587
- },
1588
- "public.finance_events": {
1589
- "name": "finance_events",
1590
- "schema": "",
1591
- "columns": {
1592
- "id": {
1593
- "name": "id",
1594
- "type": "text",
1595
- "primaryKey": true,
1596
- "notNull": true
1597
- },
1598
- "workspace_id": {
1599
- "name": "workspace_id",
1600
- "type": "text",
1601
- "primaryKey": false,
1602
- "notNull": false
1603
- },
1604
- "stripe_event_id": {
1605
- "name": "stripe_event_id",
1606
- "type": "text",
1607
- "primaryKey": false,
1608
- "notNull": true
1609
- },
1610
- "type": {
1611
- "name": "type",
1612
- "type": "text",
1613
- "primaryKey": false,
1614
- "notNull": true
1615
- },
1616
- "amount": {
1617
- "name": "amount",
1618
- "type": "integer",
1619
- "primaryKey": false,
1620
- "notNull": false
1621
- },
1622
- "currency": {
1623
- "name": "currency",
1624
- "type": "text",
1625
- "primaryKey": false,
1626
- "notNull": false,
1627
- "default": "'usd'"
1628
- },
1629
- "metadata": {
1630
- "name": "metadata",
1631
- "type": "text",
1632
- "primaryKey": false,
1633
- "notNull": false
1634
- },
1635
- "processed_at": {
1636
- "name": "processed_at",
1637
- "type": "timestamp",
1638
- "primaryKey": false,
1639
- "notNull": false
1640
- },
1641
- "created_at": {
1642
- "name": "created_at",
1643
- "type": "timestamp",
1644
- "primaryKey": false,
1645
- "notNull": true,
1646
- "default": "now()"
1647
- }
1648
- },
1649
- "indexes": {},
1650
- "foreignKeys": {
1651
- "finance_events_workspace_id_organization_id_fk": {
1652
- "name": "finance_events_workspace_id_organization_id_fk",
1653
- "tableFrom": "finance_events",
1654
- "tableTo": "organization",
1655
- "columnsFrom": ["workspace_id"],
1656
- "columnsTo": ["id"],
1657
- "onDelete": "no action",
1658
- "onUpdate": "no action"
1659
- }
1660
- },
1661
- "compositePrimaryKeys": {},
1662
- "uniqueConstraints": {
1663
- "finance_events_stripe_event_id_unique": {
1664
- "name": "finance_events_stripe_event_id_unique",
1665
- "nullsNotDistinct": false,
1666
- "columns": ["stripe_event_id"]
1667
- }
1668
- },
1669
- "policies": {},
1670
- "checkConstraints": {},
1671
- "isRLSEnabled": false
1672
- },
1673
- "public.plans": {
1674
- "name": "plans",
1675
- "schema": "",
1676
- "columns": {
1677
- "id": {
1678
- "name": "id",
1679
- "type": "text",
1680
- "primaryKey": true,
1681
- "notNull": true
1682
- },
1683
- "name": {
1684
- "name": "name",
1685
- "type": "text",
1686
- "primaryKey": false,
1687
- "notNull": true
1688
- },
1689
- "slug": {
1690
- "name": "slug",
1691
- "type": "text",
1692
- "primaryKey": false,
1693
- "notNull": true
1694
- },
1695
- "description": {
1696
- "name": "description",
1697
- "type": "text",
1698
- "primaryKey": false,
1699
- "notNull": false
1700
- },
1701
- "price_monthly": {
1702
- "name": "price_monthly",
1703
- "type": "integer",
1704
- "primaryKey": false,
1705
- "notNull": true
1706
- },
1707
- "price_yearly": {
1708
- "name": "price_yearly",
1709
- "type": "integer",
1710
- "primaryKey": false,
1711
- "notNull": true
1712
- },
1713
- "stripe_price_id_monthly": {
1714
- "name": "stripe_price_id_monthly",
1715
- "type": "text",
1716
- "primaryKey": false,
1717
- "notNull": false
1718
- },
1719
- "stripe_price_id_yearly": {
1720
- "name": "stripe_price_id_yearly",
1721
- "type": "text",
1722
- "primaryKey": false,
1723
- "notNull": false
1724
- },
1725
- "features": {
1726
- "name": "features",
1727
- "type": "text",
1728
- "primaryKey": false,
1729
- "notNull": true
1730
- },
1731
- "limits": {
1732
- "name": "limits",
1733
- "type": "text",
1734
- "primaryKey": false,
1735
- "notNull": true
1736
- },
1737
- "is_active": {
1738
- "name": "is_active",
1739
- "type": "boolean",
1740
- "primaryKey": false,
1741
- "notNull": true,
1742
- "default": true
1743
- },
1744
- "sort_order": {
1745
- "name": "sort_order",
1746
- "type": "integer",
1747
- "primaryKey": false,
1748
- "notNull": true,
1749
- "default": 0
1750
- },
1751
- "created_at": {
1752
- "name": "created_at",
1753
- "type": "timestamp",
1754
- "primaryKey": false,
1755
- "notNull": true,
1756
- "default": "now()"
1757
- },
1758
- "updated_at": {
1759
- "name": "updated_at",
1760
- "type": "timestamp",
1761
- "primaryKey": false,
1762
- "notNull": true,
1763
- "default": "now()"
1764
- }
1765
- },
1766
- "indexes": {},
1767
- "foreignKeys": {},
1768
- "compositePrimaryKeys": {},
1769
- "uniqueConstraints": {
1770
- "plans_slug_unique": {
1771
- "name": "plans_slug_unique",
1772
- "nullsNotDistinct": false,
1773
- "columns": ["slug"]
1774
- }
1775
- },
1776
- "policies": {},
1777
- "checkConstraints": {},
1778
- "isRLSEnabled": false
1779
- },
1780
- "public.subscriptions": {
1781
- "name": "subscriptions",
1782
- "schema": "",
1783
- "columns": {
1784
- "id": {
1785
- "name": "id",
1786
- "type": "text",
1787
- "primaryKey": true,
1788
- "notNull": true
1789
- },
1790
- "workspace_id": {
1791
- "name": "workspace_id",
1792
- "type": "text",
1793
- "primaryKey": false,
1794
- "notNull": true
1795
- },
1796
- "plan_id": {
1797
- "name": "plan_id",
1798
- "type": "text",
1799
- "primaryKey": false,
1800
- "notNull": true
1801
- },
1802
- "stripe_customer_id": {
1803
- "name": "stripe_customer_id",
1804
- "type": "text",
1805
- "primaryKey": false,
1806
- "notNull": false
1807
- },
1808
- "stripe_subscription_id": {
1809
- "name": "stripe_subscription_id",
1810
- "type": "text",
1811
- "primaryKey": false,
1812
- "notNull": false
1813
- },
1814
- "status": {
1815
- "name": "status",
1816
- "type": "text",
1817
- "primaryKey": false,
1818
- "notNull": true,
1819
- "default": "'active'"
1820
- },
1821
- "billing_mode": {
1822
- "name": "billing_mode",
1823
- "type": "text",
1824
- "primaryKey": false,
1825
- "notNull": true,
1826
- "default": "'subscription'"
1827
- },
1828
- "current_period_start": {
1829
- "name": "current_period_start",
1830
- "type": "timestamp",
1831
- "primaryKey": false,
1832
- "notNull": false
1833
- },
1834
- "current_period_end": {
1835
- "name": "current_period_end",
1836
- "type": "timestamp",
1837
- "primaryKey": false,
1838
- "notNull": false
1839
- },
1840
- "cancel_at_period_end": {
1841
- "name": "cancel_at_period_end",
1842
- "type": "boolean",
1843
- "primaryKey": false,
1844
- "notNull": true,
1845
- "default": false
1846
- },
1847
- "created_at": {
1848
- "name": "created_at",
1849
- "type": "timestamp",
1850
- "primaryKey": false,
1851
- "notNull": true,
1852
- "default": "now()"
1853
- },
1854
- "updated_at": {
1855
- "name": "updated_at",
1856
- "type": "timestamp",
1857
- "primaryKey": false,
1858
- "notNull": true,
1859
- "default": "now()"
1860
- }
1861
- },
1862
- "indexes": {
1863
- "subscriptions_workspace_id_idx": {
1864
- "name": "subscriptions_workspace_id_idx",
1865
- "columns": [
1866
- {
1867
- "expression": "workspace_id",
1868
- "isExpression": false,
1869
- "asc": true,
1870
- "nulls": "last"
1871
- }
1872
- ],
1873
- "isUnique": false,
1874
- "concurrently": false,
1875
- "method": "btree",
1876
- "with": {}
1877
- }
1878
- },
1879
- "foreignKeys": {
1880
- "subscriptions_workspace_id_organization_id_fk": {
1881
- "name": "subscriptions_workspace_id_organization_id_fk",
1882
- "tableFrom": "subscriptions",
1883
- "tableTo": "organization",
1884
- "columnsFrom": ["workspace_id"],
1885
- "columnsTo": ["id"],
1886
- "onDelete": "cascade",
1887
- "onUpdate": "no action"
1888
- },
1889
- "subscriptions_plan_id_plans_id_fk": {
1890
- "name": "subscriptions_plan_id_plans_id_fk",
1891
- "tableFrom": "subscriptions",
1892
- "tableTo": "plans",
1893
- "columnsFrom": ["plan_id"],
1894
- "columnsTo": ["id"],
1895
- "onDelete": "restrict",
1896
- "onUpdate": "no action"
1897
- }
1898
- },
1899
- "compositePrimaryKeys": {},
1900
- "uniqueConstraints": {
1901
- "subscriptions_stripe_subscription_id_unique": {
1902
- "name": "subscriptions_stripe_subscription_id_unique",
1903
- "nullsNotDistinct": false,
1904
- "columns": ["stripe_subscription_id"]
1905
- },
1906
- "subscriptions_workspace_id_unique": {
1907
- "name": "subscriptions_workspace_id_unique",
1908
- "nullsNotDistinct": false,
1909
- "columns": ["workspace_id"]
1910
- }
1911
- },
1912
- "policies": {},
1913
- "checkConstraints": {},
1914
- "isRLSEnabled": false
1915
- },
1916
- "public.feature_flags": {
1917
- "name": "feature_flags",
1918
- "schema": "",
1919
- "columns": {
1920
- "id": {
1921
- "name": "id",
1922
- "type": "text",
1923
- "primaryKey": true,
1924
- "notNull": true
1925
- },
1926
- "name": {
1927
- "name": "name",
1928
- "type": "text",
1929
- "primaryKey": false,
1930
- "notNull": true
1931
- },
1932
- "description": {
1933
- "name": "description",
1934
- "type": "text",
1935
- "primaryKey": false,
1936
- "notNull": false
1937
- },
1938
- "enabled_plans": {
1939
- "name": "enabled_plans",
1940
- "type": "text",
1941
- "primaryKey": false,
1942
- "notNull": true
1943
- },
1944
- "is_active": {
1945
- "name": "is_active",
1946
- "type": "boolean",
1947
- "primaryKey": false,
1948
- "notNull": true,
1949
- "default": true
1950
- },
1951
- "created_at": {
1952
- "name": "created_at",
1953
- "type": "timestamp",
1954
- "primaryKey": false,
1955
- "notNull": true,
1956
- "default": "now()"
1957
- },
1958
- "updated_at": {
1959
- "name": "updated_at",
1960
- "type": "timestamp",
1961
- "primaryKey": false,
1962
- "notNull": true,
1963
- "default": "now()"
1964
- }
1965
- },
1966
- "indexes": {},
1967
- "foreignKeys": {},
1968
- "compositePrimaryKeys": {},
1969
- "uniqueConstraints": {
1970
- "feature_flags_name_unique": {
1971
- "name": "feature_flags_name_unique",
1972
- "nullsNotDistinct": false,
1973
- "columns": ["name"]
1974
- }
1975
- },
1976
- "policies": {},
1977
- "checkConstraints": {},
1978
- "isRLSEnabled": false
1979
- },
1980
- "public.monthly_usage": {
1981
- "name": "monthly_usage",
1982
- "schema": "",
1983
- "columns": {
1984
- "id": {
1985
- "name": "id",
1986
- "type": "text",
1987
- "primaryKey": true,
1988
- "notNull": true
1989
- },
1990
- "workspace_id": {
1991
- "name": "workspace_id",
1992
- "type": "text",
1993
- "primaryKey": false,
1994
- "notNull": true
1995
- },
1996
- "period_start": {
1997
- "name": "period_start",
1998
- "type": "timestamp",
1999
- "primaryKey": false,
2000
- "notNull": true
2001
- },
2002
- "period_end": {
2003
- "name": "period_end",
2004
- "type": "timestamp",
2005
- "primaryKey": false,
2006
- "notNull": true
2007
- },
2008
- "tokens_used": {
2009
- "name": "tokens_used",
2010
- "type": "integer",
2011
- "primaryKey": false,
2012
- "notNull": true,
2013
- "default": 0
2014
- },
2015
- "request_count": {
2016
- "name": "request_count",
2017
- "type": "integer",
2018
- "primaryKey": false,
2019
- "notNull": true,
2020
- "default": 0
2021
- },
2022
- "updated_at": {
2023
- "name": "updated_at",
2024
- "type": "timestamp",
2025
- "primaryKey": false,
2026
- "notNull": true,
2027
- "default": "now()"
2028
- }
2029
- },
2030
- "indexes": {
2031
- "monthly_usage_workspace_id_idx": {
2032
- "name": "monthly_usage_workspace_id_idx",
2033
- "columns": [
2034
- {
2035
- "expression": "workspace_id",
2036
- "isExpression": false,
2037
- "asc": true,
2038
- "nulls": "last"
2039
- }
2040
- ],
2041
- "isUnique": false,
2042
- "concurrently": false,
2043
- "method": "btree",
2044
- "with": {}
2045
- }
2046
- },
2047
- "foreignKeys": {
2048
- "monthly_usage_workspace_id_organization_id_fk": {
2049
- "name": "monthly_usage_workspace_id_organization_id_fk",
2050
- "tableFrom": "monthly_usage",
2051
- "tableTo": "organization",
2052
- "columnsFrom": ["workspace_id"],
2053
- "columnsTo": ["id"],
2054
- "onDelete": "cascade",
2055
- "onUpdate": "no action"
2056
- }
2057
- },
2058
- "compositePrimaryKeys": {},
2059
- "uniqueConstraints": {
2060
- "monthly_usage_workspace_period_unique": {
2061
- "name": "monthly_usage_workspace_period_unique",
2062
- "nullsNotDistinct": false,
2063
- "columns": ["workspace_id", "period_start"]
2064
- }
2065
- },
2066
- "policies": {},
2067
- "checkConstraints": {},
2068
- "isRLSEnabled": false
2069
- },
2070
- "public.notification_history": {
2071
- "name": "notification_history",
2072
- "schema": "",
2073
- "columns": {
2074
- "id": {
2075
- "name": "id",
2076
- "type": "text",
2077
- "primaryKey": true,
2078
- "notNull": true
2079
- },
2080
- "workspace_id": {
2081
- "name": "workspace_id",
2082
- "type": "text",
2083
- "primaryKey": false,
2084
- "notNull": true
2085
- },
2086
- "type": {
2087
- "name": "type",
2088
- "type": "text",
2089
- "primaryKey": false,
2090
- "notNull": true
2091
- },
2092
- "period_key": {
2093
- "name": "period_key",
2094
- "type": "text",
2095
- "primaryKey": false,
2096
- "notNull": true
2097
- },
2098
- "sent_at": {
2099
- "name": "sent_at",
2100
- "type": "timestamp",
2101
- "primaryKey": false,
2102
- "notNull": true,
2103
- "default": "now()"
2104
- },
2105
- "channel": {
2106
- "name": "channel",
2107
- "type": "text",
2108
- "primaryKey": false,
2109
- "notNull": true,
2110
- "default": "'console'"
2111
- },
2112
- "metadata": {
2113
- "name": "metadata",
2114
- "type": "text",
2115
- "primaryKey": false,
2116
- "notNull": false
2117
- }
2118
- },
2119
- "indexes": {
2120
- "notification_history_workspace_id_idx": {
2121
- "name": "notification_history_workspace_id_idx",
2122
- "columns": [
2123
- {
2124
- "expression": "workspace_id",
2125
- "isExpression": false,
2126
- "asc": true,
2127
- "nulls": "last"
2128
- }
2129
- ],
2130
- "isUnique": false,
2131
- "concurrently": false,
2132
- "method": "btree",
2133
- "with": {}
2134
- }
2135
- },
2136
- "foreignKeys": {
2137
- "notification_history_workspace_id_organization_id_fk": {
2138
- "name": "notification_history_workspace_id_organization_id_fk",
2139
- "tableFrom": "notification_history",
2140
- "tableTo": "organization",
2141
- "columnsFrom": ["workspace_id"],
2142
- "columnsTo": ["id"],
2143
- "onDelete": "cascade",
2144
- "onUpdate": "no action"
2145
- }
2146
- },
2147
- "compositePrimaryKeys": {},
2148
- "uniqueConstraints": {
2149
- "notification_history_dedup_unique": {
2150
- "name": "notification_history_dedup_unique",
2151
- "nullsNotDistinct": false,
2152
- "columns": ["workspace_id", "type", "period_key"]
2153
- }
2154
- },
2155
- "policies": {},
2156
- "checkConstraints": {},
2157
- "isRLSEnabled": false
2158
- },
2159
- "public.rate_limit_entries": {
2160
- "name": "rate_limit_entries",
2161
- "schema": "",
2162
- "columns": {
2163
- "id": {
2164
- "name": "id",
2165
- "type": "text",
2166
- "primaryKey": true,
2167
- "notNull": true
2168
- },
2169
- "workspace_id": {
2170
- "name": "workspace_id",
2171
- "type": "text",
2172
- "primaryKey": false,
2173
- "notNull": true
2174
- },
2175
- "endpoint": {
2176
- "name": "endpoint",
2177
- "type": "text",
2178
- "primaryKey": false,
2179
- "notNull": true,
2180
- "default": "'chat'"
2181
- },
2182
- "requested_at": {
2183
- "name": "requested_at",
2184
- "type": "timestamp",
2185
- "primaryKey": false,
2186
- "notNull": true,
2187
- "default": "now()"
2188
- }
2189
- },
2190
- "indexes": {
2191
- "rate_limit_entries_window_idx": {
2192
- "name": "rate_limit_entries_window_idx",
2193
- "columns": [
2194
- {
2195
- "expression": "workspace_id",
2196
- "isExpression": false,
2197
- "asc": true,
2198
- "nulls": "last"
2199
- },
2200
- {
2201
- "expression": "endpoint",
2202
- "isExpression": false,
2203
- "asc": true,
2204
- "nulls": "last"
2205
- },
2206
- {
2207
- "expression": "requested_at",
2208
- "isExpression": false,
2209
- "asc": true,
2210
- "nulls": "last"
2211
- }
2212
- ],
2213
- "isUnique": false,
2214
- "concurrently": false,
2215
- "method": "btree",
2216
- "with": {}
2217
- }
2218
- },
2219
- "foreignKeys": {
2220
- "rate_limit_entries_workspace_id_organization_id_fk": {
2221
- "name": "rate_limit_entries_workspace_id_organization_id_fk",
2222
- "tableFrom": "rate_limit_entries",
2223
- "tableTo": "organization",
2224
- "columnsFrom": ["workspace_id"],
2225
- "columnsTo": ["id"],
2226
- "onDelete": "cascade",
2227
- "onUpdate": "no action"
2228
- }
2229
- },
2230
- "compositePrimaryKeys": {},
2231
- "uniqueConstraints": {},
2232
- "policies": {},
2233
- "checkConstraints": {},
2234
- "isRLSEnabled": false
2235
- },
2236
- "public.trial_credits": {
2237
- "name": "trial_credits",
2238
- "schema": "",
2239
- "columns": {
2240
- "id": {
2241
- "name": "id",
2242
- "type": "text",
2243
- "primaryKey": true,
2244
- "notNull": true
2245
- },
2246
- "workspace_id": {
2247
- "name": "workspace_id",
2248
- "type": "text",
2249
- "primaryKey": false,
2250
- "notNull": true
2251
- },
2252
- "initial_credits": {
2253
- "name": "initial_credits",
2254
- "type": "integer",
2255
- "primaryKey": false,
2256
- "notNull": true,
2257
- "default": 100000
2258
- },
2259
- "credits_used": {
2260
- "name": "credits_used",
2261
- "type": "integer",
2262
- "primaryKey": false,
2263
- "notNull": true,
2264
- "default": 0
2265
- },
2266
- "credits_remaining": {
2267
- "name": "credits_remaining",
2268
- "type": "integer",
2269
- "primaryKey": false,
2270
- "notNull": true,
2271
- "default": 100000
2272
- },
2273
- "status": {
2274
- "name": "status",
2275
- "type": "text",
2276
- "primaryKey": false,
2277
- "notNull": true,
2278
- "default": "'active'"
2279
- },
2280
- "provisioned_at": {
2281
- "name": "provisioned_at",
2282
- "type": "timestamp",
2283
- "primaryKey": false,
2284
- "notNull": true,
2285
- "default": "now()"
2286
- },
2287
- "trial_end_date": {
2288
- "name": "trial_end_date",
2289
- "type": "timestamp",
2290
- "primaryKey": false,
2291
- "notNull": false
2292
- },
2293
- "depleted_at": {
2294
- "name": "depleted_at",
2295
- "type": "timestamp",
2296
- "primaryKey": false,
2297
- "notNull": false
2298
- },
2299
- "converted_at": {
2300
- "name": "converted_at",
2301
- "type": "timestamp",
2302
- "primaryKey": false,
2303
- "notNull": false
2304
- },
2305
- "created_by_ip": {
2306
- "name": "created_by_ip",
2307
- "type": "text",
2308
- "primaryKey": false,
2309
- "notNull": false
2310
- },
2311
- "created_by_email": {
2312
- "name": "created_by_email",
2313
- "type": "text",
2314
- "primaryKey": false,
2315
- "notNull": false
2316
- }
2317
- },
2318
- "indexes": {
2319
- "trial_credits_expiry_idx": {
2320
- "name": "trial_credits_expiry_idx",
2321
- "columns": [
2322
- {
2323
- "expression": "status",
2324
- "isExpression": false,
2325
- "asc": true,
2326
- "nulls": "last"
2327
- },
2328
- {
2329
- "expression": "trial_end_date",
2330
- "isExpression": false,
2331
- "asc": true,
2332
- "nulls": "last"
2333
- }
2334
- ],
2335
- "isUnique": false,
2336
- "concurrently": false,
2337
- "method": "btree",
2338
- "with": {}
2339
- }
2340
- },
2341
- "foreignKeys": {
2342
- "trial_credits_workspace_id_organization_id_fk": {
2343
- "name": "trial_credits_workspace_id_organization_id_fk",
2344
- "tableFrom": "trial_credits",
2345
- "tableTo": "organization",
2346
- "columnsFrom": ["workspace_id"],
2347
- "columnsTo": ["id"],
2348
- "onDelete": "cascade",
2349
- "onUpdate": "no action"
2350
- }
2351
- },
2352
- "compositePrimaryKeys": {},
2353
- "uniqueConstraints": {
2354
- "trial_credits_workspace_id_unique": {
2355
- "name": "trial_credits_workspace_id_unique",
2356
- "nullsNotDistinct": false,
2357
- "columns": ["workspace_id"]
2358
- }
2359
- },
2360
- "policies": {},
2361
- "checkConstraints": {},
2362
- "isRLSEnabled": false
2363
- },
2364
- "public.usage_records": {
2365
- "name": "usage_records",
2366
- "schema": "",
2367
- "columns": {
2368
- "id": {
2369
- "name": "id",
2370
- "type": "text",
2371
- "primaryKey": true,
2372
- "notNull": true
2373
- },
2374
- "workspace_id": {
2375
- "name": "workspace_id",
2376
- "type": "text",
2377
- "primaryKey": false,
2378
- "notNull": true
2379
- },
2380
- "user_id": {
2381
- "name": "user_id",
2382
- "type": "text",
2383
- "primaryKey": false,
2384
- "notNull": true
2385
- },
2386
- "type": {
2387
- "name": "type",
2388
- "type": "text",
2389
- "primaryKey": false,
2390
- "notNull": true
2391
- },
2392
- "model": {
2393
- "name": "model",
2394
- "type": "text",
2395
- "primaryKey": false,
2396
- "notNull": false
2397
- },
2398
- "agent": {
2399
- "name": "agent",
2400
- "type": "text",
2401
- "primaryKey": false,
2402
- "notNull": false
2403
- },
2404
- "input_tokens": {
2405
- "name": "input_tokens",
2406
- "type": "integer",
2407
- "primaryKey": false,
2408
- "notNull": true,
2409
- "default": 0
2410
- },
2411
- "output_tokens": {
2412
- "name": "output_tokens",
2413
- "type": "integer",
2414
- "primaryKey": false,
2415
- "notNull": true,
2416
- "default": 0
2417
- },
2418
- "total_tokens": {
2419
- "name": "total_tokens",
2420
- "type": "integer",
2421
- "primaryKey": false,
2422
- "notNull": true,
2423
- "default": 0
2424
- },
2425
- "metadata": {
2426
- "name": "metadata",
2427
- "type": "text",
2428
- "primaryKey": false,
2429
- "notNull": false
2430
- },
2431
- "recorded_at": {
2432
- "name": "recorded_at",
2433
- "type": "timestamp",
2434
- "primaryKey": false,
2435
- "notNull": true,
2436
- "default": "now()"
2437
- }
2438
- },
2439
- "indexes": {
2440
- "usage_records_workspace_id_idx": {
2441
- "name": "usage_records_workspace_id_idx",
2442
- "columns": [
2443
- {
2444
- "expression": "workspace_id",
2445
- "isExpression": false,
2446
- "asc": true,
2447
- "nulls": "last"
2448
- }
2449
- ],
2450
- "isUnique": false,
2451
- "concurrently": false,
2452
- "method": "btree",
2453
- "with": {}
2454
- },
2455
- "usage_records_workspace_recorded_at_idx": {
2456
- "name": "usage_records_workspace_recorded_at_idx",
2457
- "columns": [
2458
- {
2459
- "expression": "workspace_id",
2460
- "isExpression": false,
2461
- "asc": true,
2462
- "nulls": "last"
2463
- },
2464
- {
2465
- "expression": "recorded_at",
2466
- "isExpression": false,
2467
- "asc": true,
2468
- "nulls": "last"
2469
- }
2470
- ],
2471
- "isUnique": false,
2472
- "concurrently": false,
2473
- "method": "btree",
2474
- "with": {}
2475
- },
2476
- "usage_records_workspace_type_idx": {
2477
- "name": "usage_records_workspace_type_idx",
2478
- "columns": [
2479
- {
2480
- "expression": "workspace_id",
2481
- "isExpression": false,
2482
- "asc": true,
2483
- "nulls": "last"
2484
- },
2485
- {
2486
- "expression": "type",
2487
- "isExpression": false,
2488
- "asc": true,
2489
- "nulls": "last"
2490
- }
2491
- ],
2492
- "isUnique": false,
2493
- "concurrently": false,
2494
- "method": "btree",
2495
- "with": {}
2496
- }
2497
- },
2498
- "foreignKeys": {
2499
- "usage_records_workspace_id_organization_id_fk": {
2500
- "name": "usage_records_workspace_id_organization_id_fk",
2501
- "tableFrom": "usage_records",
2502
- "tableTo": "organization",
2503
- "columnsFrom": ["workspace_id"],
2504
- "columnsTo": ["id"],
2505
- "onDelete": "cascade",
2506
- "onUpdate": "no action"
2507
- },
2508
- "usage_records_user_id_users_id_fk": {
2509
- "name": "usage_records_user_id_users_id_fk",
2510
- "tableFrom": "usage_records",
2511
- "tableTo": "users",
2512
- "columnsFrom": ["user_id"],
2513
- "columnsTo": ["id"],
2514
- "onDelete": "cascade",
2515
- "onUpdate": "no action"
2516
- }
2517
- },
2518
- "compositePrimaryKeys": {},
2519
- "uniqueConstraints": {},
2520
- "policies": {},
2521
- "checkConstraints": {},
2522
- "isRLSEnabled": false
2523
- },
2524
- "public.notifications": {
2525
- "name": "notifications",
2526
- "schema": "",
2527
- "columns": {
2528
- "id": {
2529
- "name": "id",
2530
- "type": "text",
2531
- "primaryKey": true,
2532
- "notNull": true
2533
- },
2534
- "user_id": {
2535
- "name": "user_id",
2536
- "type": "text",
2537
- "primaryKey": false,
2538
- "notNull": true
2539
- },
2540
- "workspace_id": {
2541
- "name": "workspace_id",
2542
- "type": "text",
2543
- "primaryKey": false,
2544
- "notNull": false
2545
- },
2546
- "type": {
2547
- "name": "type",
2548
- "type": "text",
2549
- "primaryKey": false,
2550
- "notNull": true
2551
- },
2552
- "title": {
2553
- "name": "title",
2554
- "type": "text",
2555
- "primaryKey": false,
2556
- "notNull": true
2557
- },
2558
- "message": {
2559
- "name": "message",
2560
- "type": "text",
2561
- "primaryKey": false,
2562
- "notNull": true
2563
- },
2564
- "is_read": {
2565
- "name": "is_read",
2566
- "type": "boolean",
2567
- "primaryKey": false,
2568
- "notNull": true,
2569
- "default": false
2570
- },
2571
- "metadata": {
2572
- "name": "metadata",
2573
- "type": "text",
2574
- "primaryKey": false,
2575
- "notNull": false
2576
- },
2577
- "created_at": {
2578
- "name": "created_at",
2579
- "type": "timestamp",
2580
- "primaryKey": false,
2581
- "notNull": true,
2582
- "default": "now()"
2583
- }
2584
- },
2585
- "indexes": {
2586
- "notifications_user_id_idx": {
2587
- "name": "notifications_user_id_idx",
2588
- "columns": [
2589
- {
2590
- "expression": "user_id",
2591
- "isExpression": false,
2592
- "asc": true,
2593
- "nulls": "last"
2594
- }
2595
- ],
2596
- "isUnique": false,
2597
- "concurrently": false,
2598
- "method": "btree",
2599
- "with": {}
2600
- },
2601
- "notifications_user_id_is_read_idx": {
2602
- "name": "notifications_user_id_is_read_idx",
2603
- "columns": [
2604
- {
2605
- "expression": "user_id",
2606
- "isExpression": false,
2607
- "asc": true,
2608
- "nulls": "last"
2609
- },
2610
- {
2611
- "expression": "is_read",
2612
- "isExpression": false,
2613
- "asc": true,
2614
- "nulls": "last"
2615
- }
2616
- ],
2617
- "isUnique": false,
2618
- "concurrently": false,
2619
- "method": "btree",
2620
- "with": {}
2621
- },
2622
- "notifications_created_at_idx": {
2623
- "name": "notifications_created_at_idx",
2624
- "columns": [
2625
- {
2626
- "expression": "created_at",
2627
- "isExpression": false,
2628
- "asc": true,
2629
- "nulls": "last"
2630
- }
2631
- ],
2632
- "isUnique": false,
2633
- "concurrently": false,
2634
- "method": "btree",
2635
- "with": {}
2636
- }
2637
- },
2638
- "foreignKeys": {},
2639
- "compositePrimaryKeys": {},
2640
- "uniqueConstraints": {},
2641
- "policies": {},
2642
- "checkConstraints": {},
2643
- "isRLSEnabled": false
2644
- }
2645
- },
2646
- "enums": {},
2647
- "schemas": {},
2648
- "sequences": {},
2649
- "roles": {},
2650
- "policies": {},
2651
- "views": {},
2652
- "_meta": {
2653
- "columns": {},
2654
- "schemas": {},
2655
- "tables": {}
2656
- }
2657
- }