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