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