@intelligo-dev/core 1.0.0-beta.1

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