@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,2500 @@
1
+ {
2
+ "id": "aea57837-5a0c-4d9f-accc-fb4a267e869e",
3
+ "prevId": "ff5fb189-bd70-4db4-99ab-23accd856ce2",
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
+ "created_at": {
1216
+ "name": "created_at",
1217
+ "type": "timestamp",
1218
+ "primaryKey": false,
1219
+ "notNull": true,
1220
+ "default": "now()"
1221
+ },
1222
+ "updated_at": {
1223
+ "name": "updated_at",
1224
+ "type": "timestamp",
1225
+ "primaryKey": false,
1226
+ "notNull": true,
1227
+ "default": "now()"
1228
+ }
1229
+ },
1230
+ "indexes": {},
1231
+ "foreignKeys": {},
1232
+ "compositePrimaryKeys": {},
1233
+ "uniqueConstraints": {
1234
+ "users_email_unique": {
1235
+ "name": "users_email_unique",
1236
+ "nullsNotDistinct": false,
1237
+ "columns": ["email"]
1238
+ }
1239
+ },
1240
+ "policies": {},
1241
+ "checkConstraints": {},
1242
+ "isRLSEnabled": false
1243
+ },
1244
+ "public.verifications": {
1245
+ "name": "verifications",
1246
+ "schema": "",
1247
+ "columns": {
1248
+ "id": {
1249
+ "name": "id",
1250
+ "type": "text",
1251
+ "primaryKey": true,
1252
+ "notNull": true
1253
+ },
1254
+ "identifier": {
1255
+ "name": "identifier",
1256
+ "type": "text",
1257
+ "primaryKey": false,
1258
+ "notNull": true
1259
+ },
1260
+ "value": {
1261
+ "name": "value",
1262
+ "type": "text",
1263
+ "primaryKey": false,
1264
+ "notNull": true
1265
+ },
1266
+ "expires_at": {
1267
+ "name": "expires_at",
1268
+ "type": "timestamp",
1269
+ "primaryKey": false,
1270
+ "notNull": true
1271
+ },
1272
+ "created_at": {
1273
+ "name": "created_at",
1274
+ "type": "timestamp",
1275
+ "primaryKey": false,
1276
+ "notNull": true,
1277
+ "default": "now()"
1278
+ },
1279
+ "updated_at": {
1280
+ "name": "updated_at",
1281
+ "type": "timestamp",
1282
+ "primaryKey": false,
1283
+ "notNull": true,
1284
+ "default": "now()"
1285
+ }
1286
+ },
1287
+ "indexes": {},
1288
+ "foreignKeys": {},
1289
+ "compositePrimaryKeys": {},
1290
+ "uniqueConstraints": {},
1291
+ "policies": {},
1292
+ "checkConstraints": {},
1293
+ "isRLSEnabled": false
1294
+ },
1295
+ "public.credit_balances": {
1296
+ "name": "credit_balances",
1297
+ "schema": "",
1298
+ "columns": {
1299
+ "id": {
1300
+ "name": "id",
1301
+ "type": "text",
1302
+ "primaryKey": true,
1303
+ "notNull": true
1304
+ },
1305
+ "workspace_id": {
1306
+ "name": "workspace_id",
1307
+ "type": "text",
1308
+ "primaryKey": false,
1309
+ "notNull": true
1310
+ },
1311
+ "balance": {
1312
+ "name": "balance",
1313
+ "type": "integer",
1314
+ "primaryKey": false,
1315
+ "notNull": true,
1316
+ "default": 0
1317
+ },
1318
+ "total_purchased": {
1319
+ "name": "total_purchased",
1320
+ "type": "integer",
1321
+ "primaryKey": false,
1322
+ "notNull": true,
1323
+ "default": 0
1324
+ },
1325
+ "total_used": {
1326
+ "name": "total_used",
1327
+ "type": "integer",
1328
+ "primaryKey": false,
1329
+ "notNull": true,
1330
+ "default": 0
1331
+ },
1332
+ "updated_at": {
1333
+ "name": "updated_at",
1334
+ "type": "timestamp",
1335
+ "primaryKey": false,
1336
+ "notNull": true,
1337
+ "default": "now()"
1338
+ }
1339
+ },
1340
+ "indexes": {},
1341
+ "foreignKeys": {
1342
+ "credit_balances_workspace_id_organization_id_fk": {
1343
+ "name": "credit_balances_workspace_id_organization_id_fk",
1344
+ "tableFrom": "credit_balances",
1345
+ "tableTo": "organization",
1346
+ "columnsFrom": ["workspace_id"],
1347
+ "columnsTo": ["id"],
1348
+ "onDelete": "cascade",
1349
+ "onUpdate": "no action"
1350
+ }
1351
+ },
1352
+ "compositePrimaryKeys": {},
1353
+ "uniqueConstraints": {
1354
+ "credit_balances_workspace_id_unique": {
1355
+ "name": "credit_balances_workspace_id_unique",
1356
+ "nullsNotDistinct": false,
1357
+ "columns": ["workspace_id"]
1358
+ }
1359
+ },
1360
+ "policies": {},
1361
+ "checkConstraints": {},
1362
+ "isRLSEnabled": false
1363
+ },
1364
+ "public.credit_purchases": {
1365
+ "name": "credit_purchases",
1366
+ "schema": "",
1367
+ "columns": {
1368
+ "id": {
1369
+ "name": "id",
1370
+ "type": "text",
1371
+ "primaryKey": true,
1372
+ "notNull": true
1373
+ },
1374
+ "workspace_id": {
1375
+ "name": "workspace_id",
1376
+ "type": "text",
1377
+ "primaryKey": false,
1378
+ "notNull": true
1379
+ },
1380
+ "amount": {
1381
+ "name": "amount",
1382
+ "type": "integer",
1383
+ "primaryKey": false,
1384
+ "notNull": true
1385
+ },
1386
+ "credits": {
1387
+ "name": "credits",
1388
+ "type": "integer",
1389
+ "primaryKey": false,
1390
+ "notNull": true
1391
+ },
1392
+ "stripe_payment_intent_id": {
1393
+ "name": "stripe_payment_intent_id",
1394
+ "type": "text",
1395
+ "primaryKey": false,
1396
+ "notNull": false
1397
+ },
1398
+ "stripe_checkout_session_id": {
1399
+ "name": "stripe_checkout_session_id",
1400
+ "type": "text",
1401
+ "primaryKey": false,
1402
+ "notNull": false
1403
+ },
1404
+ "status": {
1405
+ "name": "status",
1406
+ "type": "text",
1407
+ "primaryKey": false,
1408
+ "notNull": true,
1409
+ "default": "'pending'"
1410
+ },
1411
+ "created_at": {
1412
+ "name": "created_at",
1413
+ "type": "timestamp",
1414
+ "primaryKey": false,
1415
+ "notNull": true,
1416
+ "default": "now()"
1417
+ }
1418
+ },
1419
+ "indexes": {
1420
+ "credit_purchases_workspace_id_idx": {
1421
+ "name": "credit_purchases_workspace_id_idx",
1422
+ "columns": [
1423
+ {
1424
+ "expression": "workspace_id",
1425
+ "isExpression": false,
1426
+ "asc": true,
1427
+ "nulls": "last"
1428
+ }
1429
+ ],
1430
+ "isUnique": false,
1431
+ "concurrently": false,
1432
+ "method": "btree",
1433
+ "with": {}
1434
+ }
1435
+ },
1436
+ "foreignKeys": {
1437
+ "credit_purchases_workspace_id_organization_id_fk": {
1438
+ "name": "credit_purchases_workspace_id_organization_id_fk",
1439
+ "tableFrom": "credit_purchases",
1440
+ "tableTo": "organization",
1441
+ "columnsFrom": ["workspace_id"],
1442
+ "columnsTo": ["id"],
1443
+ "onDelete": "cascade",
1444
+ "onUpdate": "no action"
1445
+ }
1446
+ },
1447
+ "compositePrimaryKeys": {},
1448
+ "uniqueConstraints": {},
1449
+ "policies": {},
1450
+ "checkConstraints": {},
1451
+ "isRLSEnabled": false
1452
+ },
1453
+ "public.finance_events": {
1454
+ "name": "finance_events",
1455
+ "schema": "",
1456
+ "columns": {
1457
+ "id": {
1458
+ "name": "id",
1459
+ "type": "text",
1460
+ "primaryKey": true,
1461
+ "notNull": true
1462
+ },
1463
+ "workspace_id": {
1464
+ "name": "workspace_id",
1465
+ "type": "text",
1466
+ "primaryKey": false,
1467
+ "notNull": false
1468
+ },
1469
+ "stripe_event_id": {
1470
+ "name": "stripe_event_id",
1471
+ "type": "text",
1472
+ "primaryKey": false,
1473
+ "notNull": true
1474
+ },
1475
+ "type": {
1476
+ "name": "type",
1477
+ "type": "text",
1478
+ "primaryKey": false,
1479
+ "notNull": true
1480
+ },
1481
+ "amount": {
1482
+ "name": "amount",
1483
+ "type": "integer",
1484
+ "primaryKey": false,
1485
+ "notNull": false
1486
+ },
1487
+ "currency": {
1488
+ "name": "currency",
1489
+ "type": "text",
1490
+ "primaryKey": false,
1491
+ "notNull": false,
1492
+ "default": "'usd'"
1493
+ },
1494
+ "metadata": {
1495
+ "name": "metadata",
1496
+ "type": "text",
1497
+ "primaryKey": false,
1498
+ "notNull": false
1499
+ },
1500
+ "processed_at": {
1501
+ "name": "processed_at",
1502
+ "type": "timestamp",
1503
+ "primaryKey": false,
1504
+ "notNull": false
1505
+ },
1506
+ "created_at": {
1507
+ "name": "created_at",
1508
+ "type": "timestamp",
1509
+ "primaryKey": false,
1510
+ "notNull": true,
1511
+ "default": "now()"
1512
+ }
1513
+ },
1514
+ "indexes": {},
1515
+ "foreignKeys": {
1516
+ "finance_events_workspace_id_organization_id_fk": {
1517
+ "name": "finance_events_workspace_id_organization_id_fk",
1518
+ "tableFrom": "finance_events",
1519
+ "tableTo": "organization",
1520
+ "columnsFrom": ["workspace_id"],
1521
+ "columnsTo": ["id"],
1522
+ "onDelete": "no action",
1523
+ "onUpdate": "no action"
1524
+ }
1525
+ },
1526
+ "compositePrimaryKeys": {},
1527
+ "uniqueConstraints": {
1528
+ "finance_events_stripe_event_id_unique": {
1529
+ "name": "finance_events_stripe_event_id_unique",
1530
+ "nullsNotDistinct": false,
1531
+ "columns": ["stripe_event_id"]
1532
+ }
1533
+ },
1534
+ "policies": {},
1535
+ "checkConstraints": {},
1536
+ "isRLSEnabled": false
1537
+ },
1538
+ "public.plans": {
1539
+ "name": "plans",
1540
+ "schema": "",
1541
+ "columns": {
1542
+ "id": {
1543
+ "name": "id",
1544
+ "type": "text",
1545
+ "primaryKey": true,
1546
+ "notNull": true
1547
+ },
1548
+ "name": {
1549
+ "name": "name",
1550
+ "type": "text",
1551
+ "primaryKey": false,
1552
+ "notNull": true
1553
+ },
1554
+ "slug": {
1555
+ "name": "slug",
1556
+ "type": "text",
1557
+ "primaryKey": false,
1558
+ "notNull": true
1559
+ },
1560
+ "description": {
1561
+ "name": "description",
1562
+ "type": "text",
1563
+ "primaryKey": false,
1564
+ "notNull": false
1565
+ },
1566
+ "price_monthly": {
1567
+ "name": "price_monthly",
1568
+ "type": "integer",
1569
+ "primaryKey": false,
1570
+ "notNull": true
1571
+ },
1572
+ "price_yearly": {
1573
+ "name": "price_yearly",
1574
+ "type": "integer",
1575
+ "primaryKey": false,
1576
+ "notNull": true
1577
+ },
1578
+ "stripe_price_id_monthly": {
1579
+ "name": "stripe_price_id_monthly",
1580
+ "type": "text",
1581
+ "primaryKey": false,
1582
+ "notNull": false
1583
+ },
1584
+ "stripe_price_id_yearly": {
1585
+ "name": "stripe_price_id_yearly",
1586
+ "type": "text",
1587
+ "primaryKey": false,
1588
+ "notNull": false
1589
+ },
1590
+ "features": {
1591
+ "name": "features",
1592
+ "type": "text",
1593
+ "primaryKey": false,
1594
+ "notNull": true
1595
+ },
1596
+ "limits": {
1597
+ "name": "limits",
1598
+ "type": "text",
1599
+ "primaryKey": false,
1600
+ "notNull": true
1601
+ },
1602
+ "is_active": {
1603
+ "name": "is_active",
1604
+ "type": "boolean",
1605
+ "primaryKey": false,
1606
+ "notNull": true,
1607
+ "default": true
1608
+ },
1609
+ "sort_order": {
1610
+ "name": "sort_order",
1611
+ "type": "integer",
1612
+ "primaryKey": false,
1613
+ "notNull": true,
1614
+ "default": 0
1615
+ },
1616
+ "created_at": {
1617
+ "name": "created_at",
1618
+ "type": "timestamp",
1619
+ "primaryKey": false,
1620
+ "notNull": true,
1621
+ "default": "now()"
1622
+ },
1623
+ "updated_at": {
1624
+ "name": "updated_at",
1625
+ "type": "timestamp",
1626
+ "primaryKey": false,
1627
+ "notNull": true,
1628
+ "default": "now()"
1629
+ }
1630
+ },
1631
+ "indexes": {},
1632
+ "foreignKeys": {},
1633
+ "compositePrimaryKeys": {},
1634
+ "uniqueConstraints": {
1635
+ "plans_slug_unique": {
1636
+ "name": "plans_slug_unique",
1637
+ "nullsNotDistinct": false,
1638
+ "columns": ["slug"]
1639
+ }
1640
+ },
1641
+ "policies": {},
1642
+ "checkConstraints": {},
1643
+ "isRLSEnabled": false
1644
+ },
1645
+ "public.subscriptions": {
1646
+ "name": "subscriptions",
1647
+ "schema": "",
1648
+ "columns": {
1649
+ "id": {
1650
+ "name": "id",
1651
+ "type": "text",
1652
+ "primaryKey": true,
1653
+ "notNull": true
1654
+ },
1655
+ "workspace_id": {
1656
+ "name": "workspace_id",
1657
+ "type": "text",
1658
+ "primaryKey": false,
1659
+ "notNull": true
1660
+ },
1661
+ "plan_id": {
1662
+ "name": "plan_id",
1663
+ "type": "text",
1664
+ "primaryKey": false,
1665
+ "notNull": true
1666
+ },
1667
+ "stripe_customer_id": {
1668
+ "name": "stripe_customer_id",
1669
+ "type": "text",
1670
+ "primaryKey": false,
1671
+ "notNull": false
1672
+ },
1673
+ "stripe_subscription_id": {
1674
+ "name": "stripe_subscription_id",
1675
+ "type": "text",
1676
+ "primaryKey": false,
1677
+ "notNull": false
1678
+ },
1679
+ "status": {
1680
+ "name": "status",
1681
+ "type": "text",
1682
+ "primaryKey": false,
1683
+ "notNull": true,
1684
+ "default": "'active'"
1685
+ },
1686
+ "billing_mode": {
1687
+ "name": "billing_mode",
1688
+ "type": "text",
1689
+ "primaryKey": false,
1690
+ "notNull": true,
1691
+ "default": "'subscription'"
1692
+ },
1693
+ "current_period_start": {
1694
+ "name": "current_period_start",
1695
+ "type": "timestamp",
1696
+ "primaryKey": false,
1697
+ "notNull": false
1698
+ },
1699
+ "current_period_end": {
1700
+ "name": "current_period_end",
1701
+ "type": "timestamp",
1702
+ "primaryKey": false,
1703
+ "notNull": false
1704
+ },
1705
+ "cancel_at_period_end": {
1706
+ "name": "cancel_at_period_end",
1707
+ "type": "boolean",
1708
+ "primaryKey": false,
1709
+ "notNull": true,
1710
+ "default": false
1711
+ },
1712
+ "created_at": {
1713
+ "name": "created_at",
1714
+ "type": "timestamp",
1715
+ "primaryKey": false,
1716
+ "notNull": true,
1717
+ "default": "now()"
1718
+ },
1719
+ "updated_at": {
1720
+ "name": "updated_at",
1721
+ "type": "timestamp",
1722
+ "primaryKey": false,
1723
+ "notNull": true,
1724
+ "default": "now()"
1725
+ }
1726
+ },
1727
+ "indexes": {
1728
+ "subscriptions_workspace_id_idx": {
1729
+ "name": "subscriptions_workspace_id_idx",
1730
+ "columns": [
1731
+ {
1732
+ "expression": "workspace_id",
1733
+ "isExpression": false,
1734
+ "asc": true,
1735
+ "nulls": "last"
1736
+ }
1737
+ ],
1738
+ "isUnique": false,
1739
+ "concurrently": false,
1740
+ "method": "btree",
1741
+ "with": {}
1742
+ }
1743
+ },
1744
+ "foreignKeys": {
1745
+ "subscriptions_workspace_id_organization_id_fk": {
1746
+ "name": "subscriptions_workspace_id_organization_id_fk",
1747
+ "tableFrom": "subscriptions",
1748
+ "tableTo": "organization",
1749
+ "columnsFrom": ["workspace_id"],
1750
+ "columnsTo": ["id"],
1751
+ "onDelete": "cascade",
1752
+ "onUpdate": "no action"
1753
+ },
1754
+ "subscriptions_plan_id_plans_id_fk": {
1755
+ "name": "subscriptions_plan_id_plans_id_fk",
1756
+ "tableFrom": "subscriptions",
1757
+ "tableTo": "plans",
1758
+ "columnsFrom": ["plan_id"],
1759
+ "columnsTo": ["id"],
1760
+ "onDelete": "no action",
1761
+ "onUpdate": "no action"
1762
+ }
1763
+ },
1764
+ "compositePrimaryKeys": {},
1765
+ "uniqueConstraints": {
1766
+ "subscriptions_stripe_subscription_id_unique": {
1767
+ "name": "subscriptions_stripe_subscription_id_unique",
1768
+ "nullsNotDistinct": false,
1769
+ "columns": ["stripe_subscription_id"]
1770
+ },
1771
+ "subscriptions_workspace_id_unique": {
1772
+ "name": "subscriptions_workspace_id_unique",
1773
+ "nullsNotDistinct": false,
1774
+ "columns": ["workspace_id"]
1775
+ }
1776
+ },
1777
+ "policies": {},
1778
+ "checkConstraints": {},
1779
+ "isRLSEnabled": false
1780
+ },
1781
+ "public.feature_flags": {
1782
+ "name": "feature_flags",
1783
+ "schema": "",
1784
+ "columns": {
1785
+ "id": {
1786
+ "name": "id",
1787
+ "type": "text",
1788
+ "primaryKey": true,
1789
+ "notNull": true
1790
+ },
1791
+ "name": {
1792
+ "name": "name",
1793
+ "type": "text",
1794
+ "primaryKey": false,
1795
+ "notNull": true
1796
+ },
1797
+ "description": {
1798
+ "name": "description",
1799
+ "type": "text",
1800
+ "primaryKey": false,
1801
+ "notNull": false
1802
+ },
1803
+ "enabled_plans": {
1804
+ "name": "enabled_plans",
1805
+ "type": "text",
1806
+ "primaryKey": false,
1807
+ "notNull": true
1808
+ },
1809
+ "is_active": {
1810
+ "name": "is_active",
1811
+ "type": "boolean",
1812
+ "primaryKey": false,
1813
+ "notNull": true,
1814
+ "default": true
1815
+ },
1816
+ "created_at": {
1817
+ "name": "created_at",
1818
+ "type": "timestamp",
1819
+ "primaryKey": false,
1820
+ "notNull": true,
1821
+ "default": "now()"
1822
+ },
1823
+ "updated_at": {
1824
+ "name": "updated_at",
1825
+ "type": "timestamp",
1826
+ "primaryKey": false,
1827
+ "notNull": true,
1828
+ "default": "now()"
1829
+ }
1830
+ },
1831
+ "indexes": {},
1832
+ "foreignKeys": {},
1833
+ "compositePrimaryKeys": {},
1834
+ "uniqueConstraints": {
1835
+ "feature_flags_name_unique": {
1836
+ "name": "feature_flags_name_unique",
1837
+ "nullsNotDistinct": false,
1838
+ "columns": ["name"]
1839
+ }
1840
+ },
1841
+ "policies": {},
1842
+ "checkConstraints": {},
1843
+ "isRLSEnabled": false
1844
+ },
1845
+ "public.monthly_usage": {
1846
+ "name": "monthly_usage",
1847
+ "schema": "",
1848
+ "columns": {
1849
+ "id": {
1850
+ "name": "id",
1851
+ "type": "text",
1852
+ "primaryKey": true,
1853
+ "notNull": true
1854
+ },
1855
+ "workspace_id": {
1856
+ "name": "workspace_id",
1857
+ "type": "text",
1858
+ "primaryKey": false,
1859
+ "notNull": true
1860
+ },
1861
+ "period_start": {
1862
+ "name": "period_start",
1863
+ "type": "timestamp",
1864
+ "primaryKey": false,
1865
+ "notNull": true
1866
+ },
1867
+ "period_end": {
1868
+ "name": "period_end",
1869
+ "type": "timestamp",
1870
+ "primaryKey": false,
1871
+ "notNull": true
1872
+ },
1873
+ "tokens_used": {
1874
+ "name": "tokens_used",
1875
+ "type": "integer",
1876
+ "primaryKey": false,
1877
+ "notNull": true,
1878
+ "default": 0
1879
+ },
1880
+ "request_count": {
1881
+ "name": "request_count",
1882
+ "type": "integer",
1883
+ "primaryKey": false,
1884
+ "notNull": true,
1885
+ "default": 0
1886
+ },
1887
+ "updated_at": {
1888
+ "name": "updated_at",
1889
+ "type": "timestamp",
1890
+ "primaryKey": false,
1891
+ "notNull": true,
1892
+ "default": "now()"
1893
+ }
1894
+ },
1895
+ "indexes": {
1896
+ "monthly_usage_workspace_id_idx": {
1897
+ "name": "monthly_usage_workspace_id_idx",
1898
+ "columns": [
1899
+ {
1900
+ "expression": "workspace_id",
1901
+ "isExpression": false,
1902
+ "asc": true,
1903
+ "nulls": "last"
1904
+ }
1905
+ ],
1906
+ "isUnique": false,
1907
+ "concurrently": false,
1908
+ "method": "btree",
1909
+ "with": {}
1910
+ }
1911
+ },
1912
+ "foreignKeys": {
1913
+ "monthly_usage_workspace_id_organization_id_fk": {
1914
+ "name": "monthly_usage_workspace_id_organization_id_fk",
1915
+ "tableFrom": "monthly_usage",
1916
+ "tableTo": "organization",
1917
+ "columnsFrom": ["workspace_id"],
1918
+ "columnsTo": ["id"],
1919
+ "onDelete": "cascade",
1920
+ "onUpdate": "no action"
1921
+ }
1922
+ },
1923
+ "compositePrimaryKeys": {},
1924
+ "uniqueConstraints": {
1925
+ "monthly_usage_workspace_period_unique": {
1926
+ "name": "monthly_usage_workspace_period_unique",
1927
+ "nullsNotDistinct": false,
1928
+ "columns": ["workspace_id", "period_start"]
1929
+ }
1930
+ },
1931
+ "policies": {},
1932
+ "checkConstraints": {},
1933
+ "isRLSEnabled": false
1934
+ },
1935
+ "public.notification_history": {
1936
+ "name": "notification_history",
1937
+ "schema": "",
1938
+ "columns": {
1939
+ "id": {
1940
+ "name": "id",
1941
+ "type": "text",
1942
+ "primaryKey": true,
1943
+ "notNull": true
1944
+ },
1945
+ "workspace_id": {
1946
+ "name": "workspace_id",
1947
+ "type": "text",
1948
+ "primaryKey": false,
1949
+ "notNull": true
1950
+ },
1951
+ "type": {
1952
+ "name": "type",
1953
+ "type": "text",
1954
+ "primaryKey": false,
1955
+ "notNull": true
1956
+ },
1957
+ "period_key": {
1958
+ "name": "period_key",
1959
+ "type": "text",
1960
+ "primaryKey": false,
1961
+ "notNull": true
1962
+ },
1963
+ "sent_at": {
1964
+ "name": "sent_at",
1965
+ "type": "timestamp",
1966
+ "primaryKey": false,
1967
+ "notNull": true,
1968
+ "default": "now()"
1969
+ },
1970
+ "channel": {
1971
+ "name": "channel",
1972
+ "type": "text",
1973
+ "primaryKey": false,
1974
+ "notNull": true,
1975
+ "default": "'console'"
1976
+ },
1977
+ "metadata": {
1978
+ "name": "metadata",
1979
+ "type": "text",
1980
+ "primaryKey": false,
1981
+ "notNull": false
1982
+ }
1983
+ },
1984
+ "indexes": {
1985
+ "notification_history_workspace_id_idx": {
1986
+ "name": "notification_history_workspace_id_idx",
1987
+ "columns": [
1988
+ {
1989
+ "expression": "workspace_id",
1990
+ "isExpression": false,
1991
+ "asc": true,
1992
+ "nulls": "last"
1993
+ }
1994
+ ],
1995
+ "isUnique": false,
1996
+ "concurrently": false,
1997
+ "method": "btree",
1998
+ "with": {}
1999
+ }
2000
+ },
2001
+ "foreignKeys": {
2002
+ "notification_history_workspace_id_organization_id_fk": {
2003
+ "name": "notification_history_workspace_id_organization_id_fk",
2004
+ "tableFrom": "notification_history",
2005
+ "tableTo": "organization",
2006
+ "columnsFrom": ["workspace_id"],
2007
+ "columnsTo": ["id"],
2008
+ "onDelete": "cascade",
2009
+ "onUpdate": "no action"
2010
+ }
2011
+ },
2012
+ "compositePrimaryKeys": {},
2013
+ "uniqueConstraints": {
2014
+ "notification_history_dedup_unique": {
2015
+ "name": "notification_history_dedup_unique",
2016
+ "nullsNotDistinct": false,
2017
+ "columns": ["workspace_id", "type", "period_key"]
2018
+ }
2019
+ },
2020
+ "policies": {},
2021
+ "checkConstraints": {},
2022
+ "isRLSEnabled": false
2023
+ },
2024
+ "public.rate_limit_entries": {
2025
+ "name": "rate_limit_entries",
2026
+ "schema": "",
2027
+ "columns": {
2028
+ "id": {
2029
+ "name": "id",
2030
+ "type": "text",
2031
+ "primaryKey": true,
2032
+ "notNull": true
2033
+ },
2034
+ "workspace_id": {
2035
+ "name": "workspace_id",
2036
+ "type": "text",
2037
+ "primaryKey": false,
2038
+ "notNull": true
2039
+ },
2040
+ "endpoint": {
2041
+ "name": "endpoint",
2042
+ "type": "text",
2043
+ "primaryKey": false,
2044
+ "notNull": true,
2045
+ "default": "'chat'"
2046
+ },
2047
+ "requested_at": {
2048
+ "name": "requested_at",
2049
+ "type": "timestamp",
2050
+ "primaryKey": false,
2051
+ "notNull": true,
2052
+ "default": "now()"
2053
+ }
2054
+ },
2055
+ "indexes": {
2056
+ "rate_limit_entries_window_idx": {
2057
+ "name": "rate_limit_entries_window_idx",
2058
+ "columns": [
2059
+ {
2060
+ "expression": "workspace_id",
2061
+ "isExpression": false,
2062
+ "asc": true,
2063
+ "nulls": "last"
2064
+ },
2065
+ {
2066
+ "expression": "endpoint",
2067
+ "isExpression": false,
2068
+ "asc": true,
2069
+ "nulls": "last"
2070
+ },
2071
+ {
2072
+ "expression": "requested_at",
2073
+ "isExpression": false,
2074
+ "asc": true,
2075
+ "nulls": "last"
2076
+ }
2077
+ ],
2078
+ "isUnique": false,
2079
+ "concurrently": false,
2080
+ "method": "btree",
2081
+ "with": {}
2082
+ }
2083
+ },
2084
+ "foreignKeys": {
2085
+ "rate_limit_entries_workspace_id_organization_id_fk": {
2086
+ "name": "rate_limit_entries_workspace_id_organization_id_fk",
2087
+ "tableFrom": "rate_limit_entries",
2088
+ "tableTo": "organization",
2089
+ "columnsFrom": ["workspace_id"],
2090
+ "columnsTo": ["id"],
2091
+ "onDelete": "cascade",
2092
+ "onUpdate": "no action"
2093
+ }
2094
+ },
2095
+ "compositePrimaryKeys": {},
2096
+ "uniqueConstraints": {},
2097
+ "policies": {},
2098
+ "checkConstraints": {},
2099
+ "isRLSEnabled": false
2100
+ },
2101
+ "public.trial_credits": {
2102
+ "name": "trial_credits",
2103
+ "schema": "",
2104
+ "columns": {
2105
+ "id": {
2106
+ "name": "id",
2107
+ "type": "text",
2108
+ "primaryKey": true,
2109
+ "notNull": true
2110
+ },
2111
+ "workspace_id": {
2112
+ "name": "workspace_id",
2113
+ "type": "text",
2114
+ "primaryKey": false,
2115
+ "notNull": true
2116
+ },
2117
+ "initial_credits": {
2118
+ "name": "initial_credits",
2119
+ "type": "integer",
2120
+ "primaryKey": false,
2121
+ "notNull": true,
2122
+ "default": 100000
2123
+ },
2124
+ "credits_used": {
2125
+ "name": "credits_used",
2126
+ "type": "integer",
2127
+ "primaryKey": false,
2128
+ "notNull": true,
2129
+ "default": 0
2130
+ },
2131
+ "credits_remaining": {
2132
+ "name": "credits_remaining",
2133
+ "type": "integer",
2134
+ "primaryKey": false,
2135
+ "notNull": true,
2136
+ "default": 100000
2137
+ },
2138
+ "status": {
2139
+ "name": "status",
2140
+ "type": "text",
2141
+ "primaryKey": false,
2142
+ "notNull": true,
2143
+ "default": "'active'"
2144
+ },
2145
+ "provisioned_at": {
2146
+ "name": "provisioned_at",
2147
+ "type": "timestamp",
2148
+ "primaryKey": false,
2149
+ "notNull": true,
2150
+ "default": "now()"
2151
+ },
2152
+ "trial_end_date": {
2153
+ "name": "trial_end_date",
2154
+ "type": "timestamp",
2155
+ "primaryKey": false,
2156
+ "notNull": false
2157
+ },
2158
+ "depleted_at": {
2159
+ "name": "depleted_at",
2160
+ "type": "timestamp",
2161
+ "primaryKey": false,
2162
+ "notNull": false
2163
+ },
2164
+ "converted_at": {
2165
+ "name": "converted_at",
2166
+ "type": "timestamp",
2167
+ "primaryKey": false,
2168
+ "notNull": false
2169
+ },
2170
+ "created_by_ip": {
2171
+ "name": "created_by_ip",
2172
+ "type": "text",
2173
+ "primaryKey": false,
2174
+ "notNull": false
2175
+ },
2176
+ "created_by_email": {
2177
+ "name": "created_by_email",
2178
+ "type": "text",
2179
+ "primaryKey": false,
2180
+ "notNull": false
2181
+ }
2182
+ },
2183
+ "indexes": {},
2184
+ "foreignKeys": {
2185
+ "trial_credits_workspace_id_organization_id_fk": {
2186
+ "name": "trial_credits_workspace_id_organization_id_fk",
2187
+ "tableFrom": "trial_credits",
2188
+ "tableTo": "organization",
2189
+ "columnsFrom": ["workspace_id"],
2190
+ "columnsTo": ["id"],
2191
+ "onDelete": "cascade",
2192
+ "onUpdate": "no action"
2193
+ }
2194
+ },
2195
+ "compositePrimaryKeys": {},
2196
+ "uniqueConstraints": {
2197
+ "trial_credits_workspace_id_unique": {
2198
+ "name": "trial_credits_workspace_id_unique",
2199
+ "nullsNotDistinct": false,
2200
+ "columns": ["workspace_id"]
2201
+ }
2202
+ },
2203
+ "policies": {},
2204
+ "checkConstraints": {},
2205
+ "isRLSEnabled": false
2206
+ },
2207
+ "public.usage_records": {
2208
+ "name": "usage_records",
2209
+ "schema": "",
2210
+ "columns": {
2211
+ "id": {
2212
+ "name": "id",
2213
+ "type": "text",
2214
+ "primaryKey": true,
2215
+ "notNull": true
2216
+ },
2217
+ "workspace_id": {
2218
+ "name": "workspace_id",
2219
+ "type": "text",
2220
+ "primaryKey": false,
2221
+ "notNull": true
2222
+ },
2223
+ "user_id": {
2224
+ "name": "user_id",
2225
+ "type": "text",
2226
+ "primaryKey": false,
2227
+ "notNull": true
2228
+ },
2229
+ "type": {
2230
+ "name": "type",
2231
+ "type": "text",
2232
+ "primaryKey": false,
2233
+ "notNull": true
2234
+ },
2235
+ "model": {
2236
+ "name": "model",
2237
+ "type": "text",
2238
+ "primaryKey": false,
2239
+ "notNull": false
2240
+ },
2241
+ "agent": {
2242
+ "name": "agent",
2243
+ "type": "text",
2244
+ "primaryKey": false,
2245
+ "notNull": false
2246
+ },
2247
+ "input_tokens": {
2248
+ "name": "input_tokens",
2249
+ "type": "integer",
2250
+ "primaryKey": false,
2251
+ "notNull": true,
2252
+ "default": 0
2253
+ },
2254
+ "output_tokens": {
2255
+ "name": "output_tokens",
2256
+ "type": "integer",
2257
+ "primaryKey": false,
2258
+ "notNull": true,
2259
+ "default": 0
2260
+ },
2261
+ "total_tokens": {
2262
+ "name": "total_tokens",
2263
+ "type": "integer",
2264
+ "primaryKey": false,
2265
+ "notNull": true,
2266
+ "default": 0
2267
+ },
2268
+ "metadata": {
2269
+ "name": "metadata",
2270
+ "type": "text",
2271
+ "primaryKey": false,
2272
+ "notNull": false
2273
+ },
2274
+ "recorded_at": {
2275
+ "name": "recorded_at",
2276
+ "type": "timestamp",
2277
+ "primaryKey": false,
2278
+ "notNull": true,
2279
+ "default": "now()"
2280
+ }
2281
+ },
2282
+ "indexes": {
2283
+ "usage_records_workspace_id_idx": {
2284
+ "name": "usage_records_workspace_id_idx",
2285
+ "columns": [
2286
+ {
2287
+ "expression": "workspace_id",
2288
+ "isExpression": false,
2289
+ "asc": true,
2290
+ "nulls": "last"
2291
+ }
2292
+ ],
2293
+ "isUnique": false,
2294
+ "concurrently": false,
2295
+ "method": "btree",
2296
+ "with": {}
2297
+ },
2298
+ "usage_records_workspace_recorded_at_idx": {
2299
+ "name": "usage_records_workspace_recorded_at_idx",
2300
+ "columns": [
2301
+ {
2302
+ "expression": "workspace_id",
2303
+ "isExpression": false,
2304
+ "asc": true,
2305
+ "nulls": "last"
2306
+ },
2307
+ {
2308
+ "expression": "recorded_at",
2309
+ "isExpression": false,
2310
+ "asc": true,
2311
+ "nulls": "last"
2312
+ }
2313
+ ],
2314
+ "isUnique": false,
2315
+ "concurrently": false,
2316
+ "method": "btree",
2317
+ "with": {}
2318
+ },
2319
+ "usage_records_workspace_type_idx": {
2320
+ "name": "usage_records_workspace_type_idx",
2321
+ "columns": [
2322
+ {
2323
+ "expression": "workspace_id",
2324
+ "isExpression": false,
2325
+ "asc": true,
2326
+ "nulls": "last"
2327
+ },
2328
+ {
2329
+ "expression": "type",
2330
+ "isExpression": false,
2331
+ "asc": true,
2332
+ "nulls": "last"
2333
+ }
2334
+ ],
2335
+ "isUnique": false,
2336
+ "concurrently": false,
2337
+ "method": "btree",
2338
+ "with": {}
2339
+ }
2340
+ },
2341
+ "foreignKeys": {
2342
+ "usage_records_workspace_id_organization_id_fk": {
2343
+ "name": "usage_records_workspace_id_organization_id_fk",
2344
+ "tableFrom": "usage_records",
2345
+ "tableTo": "organization",
2346
+ "columnsFrom": ["workspace_id"],
2347
+ "columnsTo": ["id"],
2348
+ "onDelete": "cascade",
2349
+ "onUpdate": "no action"
2350
+ },
2351
+ "usage_records_user_id_users_id_fk": {
2352
+ "name": "usage_records_user_id_users_id_fk",
2353
+ "tableFrom": "usage_records",
2354
+ "tableTo": "users",
2355
+ "columnsFrom": ["user_id"],
2356
+ "columnsTo": ["id"],
2357
+ "onDelete": "cascade",
2358
+ "onUpdate": "no action"
2359
+ }
2360
+ },
2361
+ "compositePrimaryKeys": {},
2362
+ "uniqueConstraints": {},
2363
+ "policies": {},
2364
+ "checkConstraints": {},
2365
+ "isRLSEnabled": false
2366
+ },
2367
+ "public.notifications": {
2368
+ "name": "notifications",
2369
+ "schema": "",
2370
+ "columns": {
2371
+ "id": {
2372
+ "name": "id",
2373
+ "type": "text",
2374
+ "primaryKey": true,
2375
+ "notNull": true
2376
+ },
2377
+ "user_id": {
2378
+ "name": "user_id",
2379
+ "type": "text",
2380
+ "primaryKey": false,
2381
+ "notNull": true
2382
+ },
2383
+ "workspace_id": {
2384
+ "name": "workspace_id",
2385
+ "type": "text",
2386
+ "primaryKey": false,
2387
+ "notNull": false
2388
+ },
2389
+ "type": {
2390
+ "name": "type",
2391
+ "type": "text",
2392
+ "primaryKey": false,
2393
+ "notNull": true
2394
+ },
2395
+ "title": {
2396
+ "name": "title",
2397
+ "type": "text",
2398
+ "primaryKey": false,
2399
+ "notNull": true
2400
+ },
2401
+ "message": {
2402
+ "name": "message",
2403
+ "type": "text",
2404
+ "primaryKey": false,
2405
+ "notNull": true
2406
+ },
2407
+ "is_read": {
2408
+ "name": "is_read",
2409
+ "type": "boolean",
2410
+ "primaryKey": false,
2411
+ "notNull": true,
2412
+ "default": false
2413
+ },
2414
+ "metadata": {
2415
+ "name": "metadata",
2416
+ "type": "text",
2417
+ "primaryKey": false,
2418
+ "notNull": false
2419
+ },
2420
+ "created_at": {
2421
+ "name": "created_at",
2422
+ "type": "timestamp",
2423
+ "primaryKey": false,
2424
+ "notNull": true,
2425
+ "default": "now()"
2426
+ }
2427
+ },
2428
+ "indexes": {
2429
+ "notifications_user_id_idx": {
2430
+ "name": "notifications_user_id_idx",
2431
+ "columns": [
2432
+ {
2433
+ "expression": "user_id",
2434
+ "isExpression": false,
2435
+ "asc": true,
2436
+ "nulls": "last"
2437
+ }
2438
+ ],
2439
+ "isUnique": false,
2440
+ "concurrently": false,
2441
+ "method": "btree",
2442
+ "with": {}
2443
+ },
2444
+ "notifications_user_id_is_read_idx": {
2445
+ "name": "notifications_user_id_is_read_idx",
2446
+ "columns": [
2447
+ {
2448
+ "expression": "user_id",
2449
+ "isExpression": false,
2450
+ "asc": true,
2451
+ "nulls": "last"
2452
+ },
2453
+ {
2454
+ "expression": "is_read",
2455
+ "isExpression": false,
2456
+ "asc": true,
2457
+ "nulls": "last"
2458
+ }
2459
+ ],
2460
+ "isUnique": false,
2461
+ "concurrently": false,
2462
+ "method": "btree",
2463
+ "with": {}
2464
+ },
2465
+ "notifications_created_at_idx": {
2466
+ "name": "notifications_created_at_idx",
2467
+ "columns": [
2468
+ {
2469
+ "expression": "created_at",
2470
+ "isExpression": false,
2471
+ "asc": true,
2472
+ "nulls": "last"
2473
+ }
2474
+ ],
2475
+ "isUnique": false,
2476
+ "concurrently": false,
2477
+ "method": "btree",
2478
+ "with": {}
2479
+ }
2480
+ },
2481
+ "foreignKeys": {},
2482
+ "compositePrimaryKeys": {},
2483
+ "uniqueConstraints": {},
2484
+ "policies": {},
2485
+ "checkConstraints": {},
2486
+ "isRLSEnabled": false
2487
+ }
2488
+ },
2489
+ "enums": {},
2490
+ "schemas": {},
2491
+ "sequences": {},
2492
+ "roles": {},
2493
+ "policies": {},
2494
+ "views": {},
2495
+ "_meta": {
2496
+ "columns": {},
2497
+ "schemas": {},
2498
+ "tables": {}
2499
+ }
2500
+ }