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