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