@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,3886 @@
1
+ {
2
+ "id": "517efc34-cf87-406b-8011-015fe6efa1b8",
3
+ "prevId": "0dce166e-3eb7-4072-a10b-e37ad6a4900f",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.agents": {
8
+ "name": "agents",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "text",
14
+ "primaryKey": true,
15
+ "notNull": true
16
+ },
17
+ "name": {
18
+ "name": "name",
19
+ "type": "jsonb",
20
+ "primaryKey": false,
21
+ "notNull": true
22
+ },
23
+ "description": {
24
+ "name": "description",
25
+ "type": "jsonb",
26
+ "primaryKey": false,
27
+ "notNull": true
28
+ },
29
+ "system_prompt_key": {
30
+ "name": "system_prompt_key",
31
+ "type": "text",
32
+ "primaryKey": false,
33
+ "notNull": true
34
+ },
35
+ "icon": {
36
+ "name": "icon",
37
+ "type": "text",
38
+ "primaryKey": false,
39
+ "notNull": true
40
+ },
41
+ "default_model": {
42
+ "name": "default_model",
43
+ "type": "text",
44
+ "primaryKey": false,
45
+ "notNull": true
46
+ },
47
+ "max_steps": {
48
+ "name": "max_steps",
49
+ "type": "integer",
50
+ "primaryKey": false,
51
+ "notNull": true
52
+ },
53
+ "context_window_size": {
54
+ "name": "context_window_size",
55
+ "type": "integer",
56
+ "primaryKey": false,
57
+ "notNull": true
58
+ },
59
+ "tools": {
60
+ "name": "tools",
61
+ "type": "jsonb",
62
+ "primaryKey": false,
63
+ "notNull": true,
64
+ "default": "'[]'::jsonb"
65
+ },
66
+ "base_path": {
67
+ "name": "base_path",
68
+ "type": "text",
69
+ "primaryKey": false,
70
+ "notNull": true
71
+ },
72
+ "is_active": {
73
+ "name": "is_active",
74
+ "type": "boolean",
75
+ "primaryKey": false,
76
+ "notNull": true,
77
+ "default": true
78
+ },
79
+ "suggestions": {
80
+ "name": "suggestions",
81
+ "type": "jsonb",
82
+ "primaryKey": false,
83
+ "notNull": true,
84
+ "default": "'[]'::jsonb"
85
+ },
86
+ "is_system": {
87
+ "name": "is_system",
88
+ "type": "boolean",
89
+ "primaryKey": false,
90
+ "notNull": true,
91
+ "default": true
92
+ },
93
+ "feature_key": {
94
+ "name": "feature_key",
95
+ "type": "text",
96
+ "primaryKey": false,
97
+ "notNull": false
98
+ },
99
+ "product_type": {
100
+ "name": "product_type",
101
+ "type": "text",
102
+ "primaryKey": false,
103
+ "notNull": true,
104
+ "default": "'chat'"
105
+ },
106
+ "color": {
107
+ "name": "color",
108
+ "type": "text",
109
+ "primaryKey": false,
110
+ "notNull": true,
111
+ "default": "'bg-gray-500'"
112
+ },
113
+ "created_at": {
114
+ "name": "created_at",
115
+ "type": "timestamp",
116
+ "primaryKey": false,
117
+ "notNull": true,
118
+ "default": "now()"
119
+ },
120
+ "updated_at": {
121
+ "name": "updated_at",
122
+ "type": "timestamp",
123
+ "primaryKey": false,
124
+ "notNull": true,
125
+ "default": "now()"
126
+ }
127
+ },
128
+ "indexes": {},
129
+ "foreignKeys": {},
130
+ "compositePrimaryKeys": {},
131
+ "uniqueConstraints": {},
132
+ "policies": {},
133
+ "checkConstraints": {},
134
+ "isRLSEnabled": false
135
+ },
136
+ "public.competition_entries": {
137
+ "name": "competition_entries",
138
+ "schema": "",
139
+ "columns": {
140
+ "id": {
141
+ "name": "id",
142
+ "type": "text",
143
+ "primaryKey": true,
144
+ "notNull": true
145
+ },
146
+ "competition_id": {
147
+ "name": "competition_id",
148
+ "type": "text",
149
+ "primaryKey": false,
150
+ "notNull": true
151
+ },
152
+ "workspace_id": {
153
+ "name": "workspace_id",
154
+ "type": "text",
155
+ "primaryKey": false,
156
+ "notNull": true
157
+ },
158
+ "school_name": {
159
+ "name": "school_name",
160
+ "type": "text",
161
+ "primaryKey": false,
162
+ "notNull": true
163
+ },
164
+ "class_name": {
165
+ "name": "class_name",
166
+ "type": "text",
167
+ "primaryKey": false,
168
+ "notNull": true
169
+ },
170
+ "assessment_count": {
171
+ "name": "assessment_count",
172
+ "type": "integer",
173
+ "primaryKey": false,
174
+ "notNull": true,
175
+ "default": 0
176
+ },
177
+ "total_score": {
178
+ "name": "total_score",
179
+ "type": "integer",
180
+ "primaryKey": false,
181
+ "notNull": true,
182
+ "default": 0
183
+ },
184
+ "created_at": {
185
+ "name": "created_at",
186
+ "type": "timestamp",
187
+ "primaryKey": false,
188
+ "notNull": true,
189
+ "default": "now()"
190
+ },
191
+ "updated_at": {
192
+ "name": "updated_at",
193
+ "type": "timestamp",
194
+ "primaryKey": false,
195
+ "notNull": true,
196
+ "default": "now()"
197
+ }
198
+ },
199
+ "indexes": {
200
+ "competition_entries_competition_id_idx": {
201
+ "name": "competition_entries_competition_id_idx",
202
+ "columns": [
203
+ {
204
+ "expression": "competition_id",
205
+ "isExpression": false,
206
+ "asc": true,
207
+ "nulls": "last"
208
+ }
209
+ ],
210
+ "isUnique": false,
211
+ "concurrently": false,
212
+ "method": "btree",
213
+ "with": {}
214
+ },
215
+ "competition_entries_workspace_id_idx": {
216
+ "name": "competition_entries_workspace_id_idx",
217
+ "columns": [
218
+ {
219
+ "expression": "workspace_id",
220
+ "isExpression": false,
221
+ "asc": true,
222
+ "nulls": "last"
223
+ }
224
+ ],
225
+ "isUnique": false,
226
+ "concurrently": false,
227
+ "method": "btree",
228
+ "with": {}
229
+ },
230
+ "competition_entries_competition_workspace_idx": {
231
+ "name": "competition_entries_competition_workspace_idx",
232
+ "columns": [
233
+ {
234
+ "expression": "competition_id",
235
+ "isExpression": false,
236
+ "asc": true,
237
+ "nulls": "last"
238
+ },
239
+ {
240
+ "expression": "workspace_id",
241
+ "isExpression": false,
242
+ "asc": true,
243
+ "nulls": "last"
244
+ }
245
+ ],
246
+ "isUnique": true,
247
+ "concurrently": false,
248
+ "method": "btree",
249
+ "with": {}
250
+ }
251
+ },
252
+ "foreignKeys": {
253
+ "competition_entries_competition_id_competitions_id_fk": {
254
+ "name": "competition_entries_competition_id_competitions_id_fk",
255
+ "tableFrom": "competition_entries",
256
+ "tableTo": "competitions",
257
+ "columnsFrom": ["competition_id"],
258
+ "columnsTo": ["id"],
259
+ "onDelete": "cascade",
260
+ "onUpdate": "no action"
261
+ },
262
+ "competition_entries_workspace_id_organization_id_fk": {
263
+ "name": "competition_entries_workspace_id_organization_id_fk",
264
+ "tableFrom": "competition_entries",
265
+ "tableTo": "organization",
266
+ "columnsFrom": ["workspace_id"],
267
+ "columnsTo": ["id"],
268
+ "onDelete": "cascade",
269
+ "onUpdate": "no action"
270
+ }
271
+ },
272
+ "compositePrimaryKeys": {},
273
+ "uniqueConstraints": {},
274
+ "policies": {},
275
+ "checkConstraints": {},
276
+ "isRLSEnabled": false
277
+ },
278
+ "public.competitions": {
279
+ "name": "competitions",
280
+ "schema": "",
281
+ "columns": {
282
+ "id": {
283
+ "name": "id",
284
+ "type": "text",
285
+ "primaryKey": true,
286
+ "notNull": true
287
+ },
288
+ "name": {
289
+ "name": "name",
290
+ "type": "jsonb",
291
+ "primaryKey": false,
292
+ "notNull": true
293
+ },
294
+ "description": {
295
+ "name": "description",
296
+ "type": "jsonb",
297
+ "primaryKey": false,
298
+ "notNull": true
299
+ },
300
+ "start_date": {
301
+ "name": "start_date",
302
+ "type": "timestamp",
303
+ "primaryKey": false,
304
+ "notNull": true
305
+ },
306
+ "end_date": {
307
+ "name": "end_date",
308
+ "type": "timestamp",
309
+ "primaryKey": false,
310
+ "notNull": true
311
+ },
312
+ "is_active": {
313
+ "name": "is_active",
314
+ "type": "boolean",
315
+ "primaryKey": false,
316
+ "notNull": true,
317
+ "default": false
318
+ },
319
+ "prize_description": {
320
+ "name": "prize_description",
321
+ "type": "jsonb",
322
+ "primaryKey": false,
323
+ "notNull": false
324
+ },
325
+ "created_at": {
326
+ "name": "created_at",
327
+ "type": "timestamp",
328
+ "primaryKey": false,
329
+ "notNull": true,
330
+ "default": "now()"
331
+ },
332
+ "updated_at": {
333
+ "name": "updated_at",
334
+ "type": "timestamp",
335
+ "primaryKey": false,
336
+ "notNull": true,
337
+ "default": "now()"
338
+ }
339
+ },
340
+ "indexes": {
341
+ "competitions_is_active_idx": {
342
+ "name": "competitions_is_active_idx",
343
+ "columns": [
344
+ {
345
+ "expression": "is_active",
346
+ "isExpression": false,
347
+ "asc": true,
348
+ "nulls": "last"
349
+ }
350
+ ],
351
+ "isUnique": false,
352
+ "concurrently": false,
353
+ "method": "btree",
354
+ "with": {}
355
+ }
356
+ },
357
+ "foreignKeys": {},
358
+ "compositePrimaryKeys": {},
359
+ "uniqueConstraints": {},
360
+ "policies": {},
361
+ "checkConstraints": {},
362
+ "isRLSEnabled": false
363
+ },
364
+ "public.conversations": {
365
+ "name": "conversations",
366
+ "schema": "",
367
+ "columns": {
368
+ "id": {
369
+ "name": "id",
370
+ "type": "text",
371
+ "primaryKey": true,
372
+ "notNull": true
373
+ },
374
+ "workspace_id": {
375
+ "name": "workspace_id",
376
+ "type": "text",
377
+ "primaryKey": false,
378
+ "notNull": true
379
+ },
380
+ "user_id": {
381
+ "name": "user_id",
382
+ "type": "text",
383
+ "primaryKey": false,
384
+ "notNull": true
385
+ },
386
+ "agent_id": {
387
+ "name": "agent_id",
388
+ "type": "text",
389
+ "primaryKey": false,
390
+ "notNull": true
391
+ },
392
+ "title": {
393
+ "name": "title",
394
+ "type": "text",
395
+ "primaryKey": false,
396
+ "notNull": false
397
+ },
398
+ "model_id": {
399
+ "name": "model_id",
400
+ "type": "text",
401
+ "primaryKey": false,
402
+ "notNull": false
403
+ },
404
+ "visibility": {
405
+ "name": "visibility",
406
+ "type": "text",
407
+ "primaryKey": false,
408
+ "notNull": true,
409
+ "default": "'private'"
410
+ },
411
+ "metadata": {
412
+ "name": "metadata",
413
+ "type": "text",
414
+ "primaryKey": false,
415
+ "notNull": false
416
+ },
417
+ "created_at": {
418
+ "name": "created_at",
419
+ "type": "timestamp",
420
+ "primaryKey": false,
421
+ "notNull": true,
422
+ "default": "now()"
423
+ },
424
+ "updated_at": {
425
+ "name": "updated_at",
426
+ "type": "timestamp",
427
+ "primaryKey": false,
428
+ "notNull": true,
429
+ "default": "now()"
430
+ }
431
+ },
432
+ "indexes": {
433
+ "conversations_workspace_id_idx": {
434
+ "name": "conversations_workspace_id_idx",
435
+ "columns": [
436
+ {
437
+ "expression": "workspace_id",
438
+ "isExpression": false,
439
+ "asc": true,
440
+ "nulls": "last"
441
+ }
442
+ ],
443
+ "isUnique": false,
444
+ "concurrently": false,
445
+ "method": "btree",
446
+ "with": {}
447
+ },
448
+ "conversations_user_id_idx": {
449
+ "name": "conversations_user_id_idx",
450
+ "columns": [
451
+ {
452
+ "expression": "user_id",
453
+ "isExpression": false,
454
+ "asc": true,
455
+ "nulls": "last"
456
+ }
457
+ ],
458
+ "isUnique": false,
459
+ "concurrently": false,
460
+ "method": "btree",
461
+ "with": {}
462
+ },
463
+ "conversations_workspace_updated_idx": {
464
+ "name": "conversations_workspace_updated_idx",
465
+ "columns": [
466
+ {
467
+ "expression": "workspace_id",
468
+ "isExpression": false,
469
+ "asc": true,
470
+ "nulls": "last"
471
+ },
472
+ {
473
+ "expression": "updated_at",
474
+ "isExpression": false,
475
+ "asc": true,
476
+ "nulls": "last"
477
+ }
478
+ ],
479
+ "isUnique": false,
480
+ "concurrently": false,
481
+ "method": "btree",
482
+ "with": {}
483
+ }
484
+ },
485
+ "foreignKeys": {
486
+ "conversations_workspace_id_organization_id_fk": {
487
+ "name": "conversations_workspace_id_organization_id_fk",
488
+ "tableFrom": "conversations",
489
+ "tableTo": "organization",
490
+ "columnsFrom": ["workspace_id"],
491
+ "columnsTo": ["id"],
492
+ "onDelete": "cascade",
493
+ "onUpdate": "no action"
494
+ },
495
+ "conversations_user_id_users_id_fk": {
496
+ "name": "conversations_user_id_users_id_fk",
497
+ "tableFrom": "conversations",
498
+ "tableTo": "users",
499
+ "columnsFrom": ["user_id"],
500
+ "columnsTo": ["id"],
501
+ "onDelete": "cascade",
502
+ "onUpdate": "no action"
503
+ }
504
+ },
505
+ "compositePrimaryKeys": {},
506
+ "uniqueConstraints": {},
507
+ "policies": {},
508
+ "checkConstraints": {},
509
+ "isRLSEnabled": false
510
+ },
511
+ "public.documents": {
512
+ "name": "documents",
513
+ "schema": "",
514
+ "columns": {
515
+ "id": {
516
+ "name": "id",
517
+ "type": "text",
518
+ "primaryKey": false,
519
+ "notNull": true
520
+ },
521
+ "created_at": {
522
+ "name": "created_at",
523
+ "type": "timestamp",
524
+ "primaryKey": false,
525
+ "notNull": true,
526
+ "default": "now()"
527
+ },
528
+ "title": {
529
+ "name": "title",
530
+ "type": "text",
531
+ "primaryKey": false,
532
+ "notNull": true
533
+ },
534
+ "content": {
535
+ "name": "content",
536
+ "type": "text",
537
+ "primaryKey": false,
538
+ "notNull": false
539
+ },
540
+ "kind": {
541
+ "name": "kind",
542
+ "type": "text",
543
+ "primaryKey": false,
544
+ "notNull": true,
545
+ "default": "'text'"
546
+ },
547
+ "user_id": {
548
+ "name": "user_id",
549
+ "type": "text",
550
+ "primaryKey": false,
551
+ "notNull": true
552
+ },
553
+ "workspace_id": {
554
+ "name": "workspace_id",
555
+ "type": "text",
556
+ "primaryKey": false,
557
+ "notNull": true
558
+ }
559
+ },
560
+ "indexes": {
561
+ "documents_workspace_id_idx": {
562
+ "name": "documents_workspace_id_idx",
563
+ "columns": [
564
+ {
565
+ "expression": "workspace_id",
566
+ "isExpression": false,
567
+ "asc": true,
568
+ "nulls": "last"
569
+ }
570
+ ],
571
+ "isUnique": false,
572
+ "concurrently": false,
573
+ "method": "btree",
574
+ "with": {}
575
+ }
576
+ },
577
+ "foreignKeys": {
578
+ "documents_user_id_users_id_fk": {
579
+ "name": "documents_user_id_users_id_fk",
580
+ "tableFrom": "documents",
581
+ "tableTo": "users",
582
+ "columnsFrom": ["user_id"],
583
+ "columnsTo": ["id"],
584
+ "onDelete": "cascade",
585
+ "onUpdate": "no action"
586
+ },
587
+ "documents_workspace_id_organization_id_fk": {
588
+ "name": "documents_workspace_id_organization_id_fk",
589
+ "tableFrom": "documents",
590
+ "tableTo": "organization",
591
+ "columnsFrom": ["workspace_id"],
592
+ "columnsTo": ["id"],
593
+ "onDelete": "cascade",
594
+ "onUpdate": "no action"
595
+ }
596
+ },
597
+ "compositePrimaryKeys": {
598
+ "documents_id_created_at_pk": {
599
+ "name": "documents_id_created_at_pk",
600
+ "columns": ["id", "created_at"]
601
+ }
602
+ },
603
+ "uniqueConstraints": {},
604
+ "policies": {},
605
+ "checkConstraints": {},
606
+ "isRLSEnabled": false
607
+ },
608
+ "public.image_generations": {
609
+ "name": "image_generations",
610
+ "schema": "",
611
+ "columns": {
612
+ "id": {
613
+ "name": "id",
614
+ "type": "text",
615
+ "primaryKey": true,
616
+ "notNull": true
617
+ },
618
+ "user_id": {
619
+ "name": "user_id",
620
+ "type": "text",
621
+ "primaryKey": false,
622
+ "notNull": true
623
+ },
624
+ "workspace_id": {
625
+ "name": "workspace_id",
626
+ "type": "text",
627
+ "primaryKey": false,
628
+ "notNull": true
629
+ },
630
+ "tool_id": {
631
+ "name": "tool_id",
632
+ "type": "text",
633
+ "primaryKey": false,
634
+ "notNull": true
635
+ },
636
+ "prompt": {
637
+ "name": "prompt",
638
+ "type": "text",
639
+ "primaryKey": false,
640
+ "notNull": true
641
+ },
642
+ "result_url": {
643
+ "name": "result_url",
644
+ "type": "text",
645
+ "primaryKey": false,
646
+ "notNull": false
647
+ },
648
+ "model": {
649
+ "name": "model",
650
+ "type": "text",
651
+ "primaryKey": false,
652
+ "notNull": true,
653
+ "default": "'gpt-image-1'"
654
+ },
655
+ "status": {
656
+ "name": "status",
657
+ "type": "text",
658
+ "primaryKey": false,
659
+ "notNull": true,
660
+ "default": "'pending'"
661
+ },
662
+ "error_message": {
663
+ "name": "error_message",
664
+ "type": "text",
665
+ "primaryKey": false,
666
+ "notNull": false
667
+ },
668
+ "created_at": {
669
+ "name": "created_at",
670
+ "type": "timestamp",
671
+ "primaryKey": false,
672
+ "notNull": true,
673
+ "default": "now()"
674
+ }
675
+ },
676
+ "indexes": {
677
+ "image_generations_user_id_idx": {
678
+ "name": "image_generations_user_id_idx",
679
+ "columns": [
680
+ {
681
+ "expression": "user_id",
682
+ "isExpression": false,
683
+ "asc": true,
684
+ "nulls": "last"
685
+ }
686
+ ],
687
+ "isUnique": false,
688
+ "concurrently": false,
689
+ "method": "btree",
690
+ "with": {}
691
+ },
692
+ "image_generations_workspace_id_idx": {
693
+ "name": "image_generations_workspace_id_idx",
694
+ "columns": [
695
+ {
696
+ "expression": "workspace_id",
697
+ "isExpression": false,
698
+ "asc": true,
699
+ "nulls": "last"
700
+ }
701
+ ],
702
+ "isUnique": false,
703
+ "concurrently": false,
704
+ "method": "btree",
705
+ "with": {}
706
+ },
707
+ "image_generations_tool_id_idx": {
708
+ "name": "image_generations_tool_id_idx",
709
+ "columns": [
710
+ {
711
+ "expression": "tool_id",
712
+ "isExpression": false,
713
+ "asc": true,
714
+ "nulls": "last"
715
+ }
716
+ ],
717
+ "isUnique": false,
718
+ "concurrently": false,
719
+ "method": "btree",
720
+ "with": {}
721
+ },
722
+ "image_generations_created_at_idx": {
723
+ "name": "image_generations_created_at_idx",
724
+ "columns": [
725
+ {
726
+ "expression": "created_at",
727
+ "isExpression": false,
728
+ "asc": true,
729
+ "nulls": "last"
730
+ }
731
+ ],
732
+ "isUnique": false,
733
+ "concurrently": false,
734
+ "method": "btree",
735
+ "with": {}
736
+ }
737
+ },
738
+ "foreignKeys": {
739
+ "image_generations_user_id_users_id_fk": {
740
+ "name": "image_generations_user_id_users_id_fk",
741
+ "tableFrom": "image_generations",
742
+ "tableTo": "users",
743
+ "columnsFrom": ["user_id"],
744
+ "columnsTo": ["id"],
745
+ "onDelete": "cascade",
746
+ "onUpdate": "no action"
747
+ },
748
+ "image_generations_workspace_id_organization_id_fk": {
749
+ "name": "image_generations_workspace_id_organization_id_fk",
750
+ "tableFrom": "image_generations",
751
+ "tableTo": "organization",
752
+ "columnsFrom": ["workspace_id"],
753
+ "columnsTo": ["id"],
754
+ "onDelete": "cascade",
755
+ "onUpdate": "no action"
756
+ },
757
+ "image_generations_tool_id_image_tools_id_fk": {
758
+ "name": "image_generations_tool_id_image_tools_id_fk",
759
+ "tableFrom": "image_generations",
760
+ "tableTo": "image_tools",
761
+ "columnsFrom": ["tool_id"],
762
+ "columnsTo": ["id"],
763
+ "onDelete": "no action",
764
+ "onUpdate": "no action"
765
+ }
766
+ },
767
+ "compositePrimaryKeys": {},
768
+ "uniqueConstraints": {},
769
+ "policies": {},
770
+ "checkConstraints": {},
771
+ "isRLSEnabled": false
772
+ },
773
+ "public.image_tools": {
774
+ "name": "image_tools",
775
+ "schema": "",
776
+ "columns": {
777
+ "id": {
778
+ "name": "id",
779
+ "type": "text",
780
+ "primaryKey": true,
781
+ "notNull": true
782
+ },
783
+ "name": {
784
+ "name": "name",
785
+ "type": "jsonb",
786
+ "primaryKey": false,
787
+ "notNull": true
788
+ },
789
+ "description": {
790
+ "name": "description",
791
+ "type": "jsonb",
792
+ "primaryKey": false,
793
+ "notNull": true
794
+ },
795
+ "category": {
796
+ "name": "category",
797
+ "type": "text",
798
+ "primaryKey": false,
799
+ "notNull": true
800
+ },
801
+ "prompt_template": {
802
+ "name": "prompt_template",
803
+ "type": "text",
804
+ "primaryKey": false,
805
+ "notNull": true
806
+ },
807
+ "model": {
808
+ "name": "model",
809
+ "type": "text",
810
+ "primaryKey": false,
811
+ "notNull": true,
812
+ "default": "'gpt-image-1'"
813
+ },
814
+ "preview_image_url": {
815
+ "name": "preview_image_url",
816
+ "type": "text",
817
+ "primaryKey": false,
818
+ "notNull": false
819
+ },
820
+ "is_active": {
821
+ "name": "is_active",
822
+ "type": "boolean",
823
+ "primaryKey": false,
824
+ "notNull": true,
825
+ "default": true
826
+ },
827
+ "sort_order": {
828
+ "name": "sort_order",
829
+ "type": "integer",
830
+ "primaryKey": false,
831
+ "notNull": true,
832
+ "default": 0
833
+ },
834
+ "is_trending": {
835
+ "name": "is_trending",
836
+ "type": "boolean",
837
+ "primaryKey": false,
838
+ "notNull": true,
839
+ "default": false
840
+ },
841
+ "is_seasonal": {
842
+ "name": "is_seasonal",
843
+ "type": "boolean",
844
+ "primaryKey": false,
845
+ "notNull": true,
846
+ "default": false
847
+ },
848
+ "active_months": {
849
+ "name": "active_months",
850
+ "type": "integer[]",
851
+ "primaryKey": false,
852
+ "notNull": false
853
+ },
854
+ "season": {
855
+ "name": "season",
856
+ "type": "text",
857
+ "primaryKey": false,
858
+ "notNull": false
859
+ },
860
+ "created_at": {
861
+ "name": "created_at",
862
+ "type": "timestamp",
863
+ "primaryKey": false,
864
+ "notNull": true,
865
+ "default": "now()"
866
+ },
867
+ "updated_at": {
868
+ "name": "updated_at",
869
+ "type": "timestamp",
870
+ "primaryKey": false,
871
+ "notNull": true,
872
+ "default": "now()"
873
+ }
874
+ },
875
+ "indexes": {},
876
+ "foreignKeys": {},
877
+ "compositePrimaryKeys": {},
878
+ "uniqueConstraints": {},
879
+ "policies": {},
880
+ "checkConstraints": {},
881
+ "isRLSEnabled": false
882
+ },
883
+ "public.knowledge_articles": {
884
+ "name": "knowledge_articles",
885
+ "schema": "",
886
+ "columns": {
887
+ "id": {
888
+ "name": "id",
889
+ "type": "text",
890
+ "primaryKey": true,
891
+ "notNull": true
892
+ },
893
+ "slug": {
894
+ "name": "slug",
895
+ "type": "text",
896
+ "primaryKey": false,
897
+ "notNull": true
898
+ },
899
+ "category": {
900
+ "name": "category",
901
+ "type": "text",
902
+ "primaryKey": false,
903
+ "notNull": true
904
+ },
905
+ "title": {
906
+ "name": "title",
907
+ "type": "jsonb",
908
+ "primaryKey": false,
909
+ "notNull": true
910
+ },
911
+ "description": {
912
+ "name": "description",
913
+ "type": "jsonb",
914
+ "primaryKey": false,
915
+ "notNull": true
916
+ },
917
+ "content": {
918
+ "name": "content",
919
+ "type": "jsonb",
920
+ "primaryKey": false,
921
+ "notNull": true
922
+ },
923
+ "tags": {
924
+ "name": "tags",
925
+ "type": "text[]",
926
+ "primaryKey": false,
927
+ "notNull": false
928
+ },
929
+ "reading_time_minutes": {
930
+ "name": "reading_time_minutes",
931
+ "type": "integer",
932
+ "primaryKey": false,
933
+ "notNull": true,
934
+ "default": 5
935
+ },
936
+ "sort_order": {
937
+ "name": "sort_order",
938
+ "type": "integer",
939
+ "primaryKey": false,
940
+ "notNull": true,
941
+ "default": 0
942
+ },
943
+ "is_published": {
944
+ "name": "is_published",
945
+ "type": "boolean",
946
+ "primaryKey": false,
947
+ "notNull": true,
948
+ "default": false
949
+ },
950
+ "created_at": {
951
+ "name": "created_at",
952
+ "type": "timestamp",
953
+ "primaryKey": false,
954
+ "notNull": true,
955
+ "default": "now()"
956
+ },
957
+ "updated_at": {
958
+ "name": "updated_at",
959
+ "type": "timestamp",
960
+ "primaryKey": false,
961
+ "notNull": true,
962
+ "default": "now()"
963
+ }
964
+ },
965
+ "indexes": {
966
+ "knowledge_articles_slug_idx": {
967
+ "name": "knowledge_articles_slug_idx",
968
+ "columns": [
969
+ {
970
+ "expression": "slug",
971
+ "isExpression": false,
972
+ "asc": true,
973
+ "nulls": "last"
974
+ }
975
+ ],
976
+ "isUnique": true,
977
+ "concurrently": false,
978
+ "method": "btree",
979
+ "with": {}
980
+ },
981
+ "knowledge_articles_category_idx": {
982
+ "name": "knowledge_articles_category_idx",
983
+ "columns": [
984
+ {
985
+ "expression": "category",
986
+ "isExpression": false,
987
+ "asc": true,
988
+ "nulls": "last"
989
+ }
990
+ ],
991
+ "isUnique": false,
992
+ "concurrently": false,
993
+ "method": "btree",
994
+ "with": {}
995
+ }
996
+ },
997
+ "foreignKeys": {},
998
+ "compositePrimaryKeys": {},
999
+ "uniqueConstraints": {},
1000
+ "policies": {},
1001
+ "checkConstraints": {},
1002
+ "isRLSEnabled": false
1003
+ },
1004
+ "public.knowledge_chunks": {
1005
+ "name": "knowledge_chunks",
1006
+ "schema": "",
1007
+ "columns": {
1008
+ "id": {
1009
+ "name": "id",
1010
+ "type": "text",
1011
+ "primaryKey": true,
1012
+ "notNull": true
1013
+ },
1014
+ "document_id": {
1015
+ "name": "document_id",
1016
+ "type": "text",
1017
+ "primaryKey": false,
1018
+ "notNull": true
1019
+ },
1020
+ "workspace_id": {
1021
+ "name": "workspace_id",
1022
+ "type": "text",
1023
+ "primaryKey": false,
1024
+ "notNull": true
1025
+ },
1026
+ "content": {
1027
+ "name": "content",
1028
+ "type": "text",
1029
+ "primaryKey": false,
1030
+ "notNull": true
1031
+ },
1032
+ "embedding": {
1033
+ "name": "embedding",
1034
+ "type": "vector(1536)",
1035
+ "primaryKey": false,
1036
+ "notNull": false
1037
+ },
1038
+ "metadata": {
1039
+ "name": "metadata",
1040
+ "type": "text",
1041
+ "primaryKey": false,
1042
+ "notNull": false
1043
+ },
1044
+ "chunk_index": {
1045
+ "name": "chunk_index",
1046
+ "type": "integer",
1047
+ "primaryKey": false,
1048
+ "notNull": true
1049
+ },
1050
+ "created_at": {
1051
+ "name": "created_at",
1052
+ "type": "timestamp",
1053
+ "primaryKey": false,
1054
+ "notNull": true,
1055
+ "default": "now()"
1056
+ }
1057
+ },
1058
+ "indexes": {
1059
+ "knowledge_chunks_document_id_idx": {
1060
+ "name": "knowledge_chunks_document_id_idx",
1061
+ "columns": [
1062
+ {
1063
+ "expression": "document_id",
1064
+ "isExpression": false,
1065
+ "asc": true,
1066
+ "nulls": "last"
1067
+ }
1068
+ ],
1069
+ "isUnique": false,
1070
+ "concurrently": false,
1071
+ "method": "btree",
1072
+ "with": {}
1073
+ },
1074
+ "knowledge_chunks_workspace_id_idx": {
1075
+ "name": "knowledge_chunks_workspace_id_idx",
1076
+ "columns": [
1077
+ {
1078
+ "expression": "workspace_id",
1079
+ "isExpression": false,
1080
+ "asc": true,
1081
+ "nulls": "last"
1082
+ }
1083
+ ],
1084
+ "isUnique": false,
1085
+ "concurrently": false,
1086
+ "method": "btree",
1087
+ "with": {}
1088
+ }
1089
+ },
1090
+ "foreignKeys": {
1091
+ "knowledge_chunks_document_id_knowledge_documents_id_fk": {
1092
+ "name": "knowledge_chunks_document_id_knowledge_documents_id_fk",
1093
+ "tableFrom": "knowledge_chunks",
1094
+ "tableTo": "knowledge_documents",
1095
+ "columnsFrom": ["document_id"],
1096
+ "columnsTo": ["id"],
1097
+ "onDelete": "cascade",
1098
+ "onUpdate": "no action"
1099
+ },
1100
+ "knowledge_chunks_workspace_id_organization_id_fk": {
1101
+ "name": "knowledge_chunks_workspace_id_organization_id_fk",
1102
+ "tableFrom": "knowledge_chunks",
1103
+ "tableTo": "organization",
1104
+ "columnsFrom": ["workspace_id"],
1105
+ "columnsTo": ["id"],
1106
+ "onDelete": "cascade",
1107
+ "onUpdate": "no action"
1108
+ }
1109
+ },
1110
+ "compositePrimaryKeys": {},
1111
+ "uniqueConstraints": {},
1112
+ "policies": {},
1113
+ "checkConstraints": {},
1114
+ "isRLSEnabled": false
1115
+ },
1116
+ "public.knowledge_documents": {
1117
+ "name": "knowledge_documents",
1118
+ "schema": "",
1119
+ "columns": {
1120
+ "id": {
1121
+ "name": "id",
1122
+ "type": "text",
1123
+ "primaryKey": true,
1124
+ "notNull": true
1125
+ },
1126
+ "workspace_id": {
1127
+ "name": "workspace_id",
1128
+ "type": "text",
1129
+ "primaryKey": false,
1130
+ "notNull": true
1131
+ },
1132
+ "filename": {
1133
+ "name": "filename",
1134
+ "type": "text",
1135
+ "primaryKey": false,
1136
+ "notNull": true
1137
+ },
1138
+ "mime_type": {
1139
+ "name": "mime_type",
1140
+ "type": "text",
1141
+ "primaryKey": false,
1142
+ "notNull": true
1143
+ },
1144
+ "size_bytes": {
1145
+ "name": "size_bytes",
1146
+ "type": "integer",
1147
+ "primaryKey": false,
1148
+ "notNull": false
1149
+ },
1150
+ "chunk_count": {
1151
+ "name": "chunk_count",
1152
+ "type": "integer",
1153
+ "primaryKey": false,
1154
+ "notNull": false,
1155
+ "default": 0
1156
+ },
1157
+ "status": {
1158
+ "name": "status",
1159
+ "type": "text",
1160
+ "primaryKey": false,
1161
+ "notNull": true,
1162
+ "default": "'processing'"
1163
+ },
1164
+ "product": {
1165
+ "name": "product",
1166
+ "type": "text",
1167
+ "primaryKey": false,
1168
+ "notNull": false
1169
+ },
1170
+ "metadata": {
1171
+ "name": "metadata",
1172
+ "type": "text",
1173
+ "primaryKey": false,
1174
+ "notNull": false
1175
+ },
1176
+ "created_at": {
1177
+ "name": "created_at",
1178
+ "type": "timestamp",
1179
+ "primaryKey": false,
1180
+ "notNull": true,
1181
+ "default": "now()"
1182
+ }
1183
+ },
1184
+ "indexes": {
1185
+ "knowledge_documents_workspace_id_idx": {
1186
+ "name": "knowledge_documents_workspace_id_idx",
1187
+ "columns": [
1188
+ {
1189
+ "expression": "workspace_id",
1190
+ "isExpression": false,
1191
+ "asc": true,
1192
+ "nulls": "last"
1193
+ }
1194
+ ],
1195
+ "isUnique": false,
1196
+ "concurrently": false,
1197
+ "method": "btree",
1198
+ "with": {}
1199
+ }
1200
+ },
1201
+ "foreignKeys": {
1202
+ "knowledge_documents_workspace_id_organization_id_fk": {
1203
+ "name": "knowledge_documents_workspace_id_organization_id_fk",
1204
+ "tableFrom": "knowledge_documents",
1205
+ "tableTo": "organization",
1206
+ "columnsFrom": ["workspace_id"],
1207
+ "columnsTo": ["id"],
1208
+ "onDelete": "cascade",
1209
+ "onUpdate": "no action"
1210
+ }
1211
+ },
1212
+ "compositePrimaryKeys": {},
1213
+ "uniqueConstraints": {},
1214
+ "policies": {},
1215
+ "checkConstraints": {},
1216
+ "isRLSEnabled": false
1217
+ },
1218
+ "public.messages": {
1219
+ "name": "messages",
1220
+ "schema": "",
1221
+ "columns": {
1222
+ "id": {
1223
+ "name": "id",
1224
+ "type": "text",
1225
+ "primaryKey": true,
1226
+ "notNull": true
1227
+ },
1228
+ "conversation_id": {
1229
+ "name": "conversation_id",
1230
+ "type": "text",
1231
+ "primaryKey": false,
1232
+ "notNull": true
1233
+ },
1234
+ "role": {
1235
+ "name": "role",
1236
+ "type": "text",
1237
+ "primaryKey": false,
1238
+ "notNull": true
1239
+ },
1240
+ "content": {
1241
+ "name": "content",
1242
+ "type": "text",
1243
+ "primaryKey": false,
1244
+ "notNull": false
1245
+ },
1246
+ "parts": {
1247
+ "name": "parts",
1248
+ "type": "text",
1249
+ "primaryKey": false,
1250
+ "notNull": true
1251
+ },
1252
+ "attachments": {
1253
+ "name": "attachments",
1254
+ "type": "text",
1255
+ "primaryKey": false,
1256
+ "notNull": false
1257
+ },
1258
+ "tool_invocations": {
1259
+ "name": "tool_invocations",
1260
+ "type": "text",
1261
+ "primaryKey": false,
1262
+ "notNull": false
1263
+ },
1264
+ "token_count": {
1265
+ "name": "token_count",
1266
+ "type": "integer",
1267
+ "primaryKey": false,
1268
+ "notNull": false
1269
+ },
1270
+ "created_at": {
1271
+ "name": "created_at",
1272
+ "type": "timestamp",
1273
+ "primaryKey": false,
1274
+ "notNull": true,
1275
+ "default": "now()"
1276
+ }
1277
+ },
1278
+ "indexes": {
1279
+ "messages_conversation_id_idx": {
1280
+ "name": "messages_conversation_id_idx",
1281
+ "columns": [
1282
+ {
1283
+ "expression": "conversation_id",
1284
+ "isExpression": false,
1285
+ "asc": true,
1286
+ "nulls": "last"
1287
+ }
1288
+ ],
1289
+ "isUnique": false,
1290
+ "concurrently": false,
1291
+ "method": "btree",
1292
+ "with": {}
1293
+ },
1294
+ "messages_conversation_created_idx": {
1295
+ "name": "messages_conversation_created_idx",
1296
+ "columns": [
1297
+ {
1298
+ "expression": "conversation_id",
1299
+ "isExpression": false,
1300
+ "asc": true,
1301
+ "nulls": "last"
1302
+ },
1303
+ {
1304
+ "expression": "created_at",
1305
+ "isExpression": false,
1306
+ "asc": true,
1307
+ "nulls": "last"
1308
+ }
1309
+ ],
1310
+ "isUnique": false,
1311
+ "concurrently": false,
1312
+ "method": "btree",
1313
+ "with": {}
1314
+ }
1315
+ },
1316
+ "foreignKeys": {
1317
+ "messages_conversation_id_conversations_id_fk": {
1318
+ "name": "messages_conversation_id_conversations_id_fk",
1319
+ "tableFrom": "messages",
1320
+ "tableTo": "conversations",
1321
+ "columnsFrom": ["conversation_id"],
1322
+ "columnsTo": ["id"],
1323
+ "onDelete": "cascade",
1324
+ "onUpdate": "no action"
1325
+ }
1326
+ },
1327
+ "compositePrimaryKeys": {},
1328
+ "uniqueConstraints": {},
1329
+ "policies": {},
1330
+ "checkConstraints": {},
1331
+ "isRLSEnabled": false
1332
+ },
1333
+ "public.referral_codes": {
1334
+ "name": "referral_codes",
1335
+ "schema": "",
1336
+ "columns": {
1337
+ "id": {
1338
+ "name": "id",
1339
+ "type": "text",
1340
+ "primaryKey": true,
1341
+ "notNull": true
1342
+ },
1343
+ "user_id": {
1344
+ "name": "user_id",
1345
+ "type": "text",
1346
+ "primaryKey": false,
1347
+ "notNull": true
1348
+ },
1349
+ "code": {
1350
+ "name": "code",
1351
+ "type": "text",
1352
+ "primaryKey": false,
1353
+ "notNull": true
1354
+ },
1355
+ "created_at": {
1356
+ "name": "created_at",
1357
+ "type": "timestamp",
1358
+ "primaryKey": false,
1359
+ "notNull": true,
1360
+ "default": "now()"
1361
+ }
1362
+ },
1363
+ "indexes": {
1364
+ "referral_codes_code_idx": {
1365
+ "name": "referral_codes_code_idx",
1366
+ "columns": [
1367
+ {
1368
+ "expression": "code",
1369
+ "isExpression": false,
1370
+ "asc": true,
1371
+ "nulls": "last"
1372
+ }
1373
+ ],
1374
+ "isUnique": true,
1375
+ "concurrently": false,
1376
+ "method": "btree",
1377
+ "with": {}
1378
+ },
1379
+ "referral_codes_user_id_idx": {
1380
+ "name": "referral_codes_user_id_idx",
1381
+ "columns": [
1382
+ {
1383
+ "expression": "user_id",
1384
+ "isExpression": false,
1385
+ "asc": true,
1386
+ "nulls": "last"
1387
+ }
1388
+ ],
1389
+ "isUnique": true,
1390
+ "concurrently": false,
1391
+ "method": "btree",
1392
+ "with": {}
1393
+ }
1394
+ },
1395
+ "foreignKeys": {
1396
+ "referral_codes_user_id_users_id_fk": {
1397
+ "name": "referral_codes_user_id_users_id_fk",
1398
+ "tableFrom": "referral_codes",
1399
+ "tableTo": "users",
1400
+ "columnsFrom": ["user_id"],
1401
+ "columnsTo": ["id"],
1402
+ "onDelete": "cascade",
1403
+ "onUpdate": "no action"
1404
+ }
1405
+ },
1406
+ "compositePrimaryKeys": {},
1407
+ "uniqueConstraints": {},
1408
+ "policies": {},
1409
+ "checkConstraints": {},
1410
+ "isRLSEnabled": false
1411
+ },
1412
+ "public.referrals": {
1413
+ "name": "referrals",
1414
+ "schema": "",
1415
+ "columns": {
1416
+ "id": {
1417
+ "name": "id",
1418
+ "type": "text",
1419
+ "primaryKey": true,
1420
+ "notNull": true
1421
+ },
1422
+ "referrer_id": {
1423
+ "name": "referrer_id",
1424
+ "type": "text",
1425
+ "primaryKey": false,
1426
+ "notNull": true
1427
+ },
1428
+ "referred_user_id": {
1429
+ "name": "referred_user_id",
1430
+ "type": "text",
1431
+ "primaryKey": false,
1432
+ "notNull": true
1433
+ },
1434
+ "referral_code_id": {
1435
+ "name": "referral_code_id",
1436
+ "type": "text",
1437
+ "primaryKey": false,
1438
+ "notNull": true
1439
+ },
1440
+ "status": {
1441
+ "name": "status",
1442
+ "type": "text",
1443
+ "primaryKey": false,
1444
+ "notNull": true,
1445
+ "default": "'pending'"
1446
+ },
1447
+ "completed_at": {
1448
+ "name": "completed_at",
1449
+ "type": "timestamp",
1450
+ "primaryKey": false,
1451
+ "notNull": false
1452
+ },
1453
+ "created_at": {
1454
+ "name": "created_at",
1455
+ "type": "timestamp",
1456
+ "primaryKey": false,
1457
+ "notNull": true,
1458
+ "default": "now()"
1459
+ }
1460
+ },
1461
+ "indexes": {
1462
+ "referrals_referrer_id_idx": {
1463
+ "name": "referrals_referrer_id_idx",
1464
+ "columns": [
1465
+ {
1466
+ "expression": "referrer_id",
1467
+ "isExpression": false,
1468
+ "asc": true,
1469
+ "nulls": "last"
1470
+ }
1471
+ ],
1472
+ "isUnique": false,
1473
+ "concurrently": false,
1474
+ "method": "btree",
1475
+ "with": {}
1476
+ },
1477
+ "referrals_referred_user_id_idx": {
1478
+ "name": "referrals_referred_user_id_idx",
1479
+ "columns": [
1480
+ {
1481
+ "expression": "referred_user_id",
1482
+ "isExpression": false,
1483
+ "asc": true,
1484
+ "nulls": "last"
1485
+ }
1486
+ ],
1487
+ "isUnique": false,
1488
+ "concurrently": false,
1489
+ "method": "btree",
1490
+ "with": {}
1491
+ },
1492
+ "referrals_referred_user_id_unique_idx": {
1493
+ "name": "referrals_referred_user_id_unique_idx",
1494
+ "columns": [
1495
+ {
1496
+ "expression": "referred_user_id",
1497
+ "isExpression": false,
1498
+ "asc": true,
1499
+ "nulls": "last"
1500
+ }
1501
+ ],
1502
+ "isUnique": true,
1503
+ "concurrently": false,
1504
+ "method": "btree",
1505
+ "with": {}
1506
+ }
1507
+ },
1508
+ "foreignKeys": {
1509
+ "referrals_referrer_id_users_id_fk": {
1510
+ "name": "referrals_referrer_id_users_id_fk",
1511
+ "tableFrom": "referrals",
1512
+ "tableTo": "users",
1513
+ "columnsFrom": ["referrer_id"],
1514
+ "columnsTo": ["id"],
1515
+ "onDelete": "cascade",
1516
+ "onUpdate": "no action"
1517
+ },
1518
+ "referrals_referred_user_id_users_id_fk": {
1519
+ "name": "referrals_referred_user_id_users_id_fk",
1520
+ "tableFrom": "referrals",
1521
+ "tableTo": "users",
1522
+ "columnsFrom": ["referred_user_id"],
1523
+ "columnsTo": ["id"],
1524
+ "onDelete": "cascade",
1525
+ "onUpdate": "no action"
1526
+ },
1527
+ "referrals_referral_code_id_referral_codes_id_fk": {
1528
+ "name": "referrals_referral_code_id_referral_codes_id_fk",
1529
+ "tableFrom": "referrals",
1530
+ "tableTo": "referral_codes",
1531
+ "columnsFrom": ["referral_code_id"],
1532
+ "columnsTo": ["id"],
1533
+ "onDelete": "cascade",
1534
+ "onUpdate": "no action"
1535
+ }
1536
+ },
1537
+ "compositePrimaryKeys": {},
1538
+ "uniqueConstraints": {},
1539
+ "policies": {},
1540
+ "checkConstraints": {},
1541
+ "isRLSEnabled": false
1542
+ },
1543
+ "public.shared_reports": {
1544
+ "name": "shared_reports",
1545
+ "schema": "",
1546
+ "columns": {
1547
+ "id": {
1548
+ "name": "id",
1549
+ "type": "text",
1550
+ "primaryKey": true,
1551
+ "notNull": true
1552
+ },
1553
+ "user_id": {
1554
+ "name": "user_id",
1555
+ "type": "text",
1556
+ "primaryKey": false,
1557
+ "notNull": true
1558
+ },
1559
+ "workspace_id": {
1560
+ "name": "workspace_id",
1561
+ "type": "text",
1562
+ "primaryKey": false,
1563
+ "notNull": true
1564
+ },
1565
+ "report_type": {
1566
+ "name": "report_type",
1567
+ "type": "text",
1568
+ "primaryKey": false,
1569
+ "notNull": true,
1570
+ "default": "'career'"
1571
+ },
1572
+ "report_data": {
1573
+ "name": "report_data",
1574
+ "type": "jsonb",
1575
+ "primaryKey": false,
1576
+ "notNull": true
1577
+ },
1578
+ "parent_report_id": {
1579
+ "name": "parent_report_id",
1580
+ "type": "text",
1581
+ "primaryKey": false,
1582
+ "notNull": false
1583
+ },
1584
+ "conversation_id": {
1585
+ "name": "conversation_id",
1586
+ "type": "text",
1587
+ "primaryKey": false,
1588
+ "notNull": false
1589
+ },
1590
+ "is_public": {
1591
+ "name": "is_public",
1592
+ "type": "boolean",
1593
+ "primaryKey": false,
1594
+ "notNull": true,
1595
+ "default": true
1596
+ },
1597
+ "view_count": {
1598
+ "name": "view_count",
1599
+ "type": "integer",
1600
+ "primaryKey": false,
1601
+ "notNull": true,
1602
+ "default": 0
1603
+ },
1604
+ "created_at": {
1605
+ "name": "created_at",
1606
+ "type": "timestamp",
1607
+ "primaryKey": false,
1608
+ "notNull": true,
1609
+ "default": "now()"
1610
+ },
1611
+ "updated_at": {
1612
+ "name": "updated_at",
1613
+ "type": "timestamp",
1614
+ "primaryKey": false,
1615
+ "notNull": true,
1616
+ "default": "now()"
1617
+ }
1618
+ },
1619
+ "indexes": {
1620
+ "shared_reports_user_id_idx": {
1621
+ "name": "shared_reports_user_id_idx",
1622
+ "columns": [
1623
+ {
1624
+ "expression": "user_id",
1625
+ "isExpression": false,
1626
+ "asc": true,
1627
+ "nulls": "last"
1628
+ }
1629
+ ],
1630
+ "isUnique": false,
1631
+ "concurrently": false,
1632
+ "method": "btree",
1633
+ "with": {}
1634
+ },
1635
+ "shared_reports_workspace_id_idx": {
1636
+ "name": "shared_reports_workspace_id_idx",
1637
+ "columns": [
1638
+ {
1639
+ "expression": "workspace_id",
1640
+ "isExpression": false,
1641
+ "asc": true,
1642
+ "nulls": "last"
1643
+ }
1644
+ ],
1645
+ "isUnique": false,
1646
+ "concurrently": false,
1647
+ "method": "btree",
1648
+ "with": {}
1649
+ }
1650
+ },
1651
+ "foreignKeys": {
1652
+ "shared_reports_user_id_users_id_fk": {
1653
+ "name": "shared_reports_user_id_users_id_fk",
1654
+ "tableFrom": "shared_reports",
1655
+ "tableTo": "users",
1656
+ "columnsFrom": ["user_id"],
1657
+ "columnsTo": ["id"],
1658
+ "onDelete": "cascade",
1659
+ "onUpdate": "no action"
1660
+ },
1661
+ "shared_reports_workspace_id_organization_id_fk": {
1662
+ "name": "shared_reports_workspace_id_organization_id_fk",
1663
+ "tableFrom": "shared_reports",
1664
+ "tableTo": "organization",
1665
+ "columnsFrom": ["workspace_id"],
1666
+ "columnsTo": ["id"],
1667
+ "onDelete": "cascade",
1668
+ "onUpdate": "no action"
1669
+ }
1670
+ },
1671
+ "compositePrimaryKeys": {},
1672
+ "uniqueConstraints": {},
1673
+ "policies": {},
1674
+ "checkConstraints": {},
1675
+ "isRLSEnabled": false
1676
+ },
1677
+ "public.suggestions": {
1678
+ "name": "suggestions",
1679
+ "schema": "",
1680
+ "columns": {
1681
+ "id": {
1682
+ "name": "id",
1683
+ "type": "text",
1684
+ "primaryKey": true,
1685
+ "notNull": true
1686
+ },
1687
+ "document_id": {
1688
+ "name": "document_id",
1689
+ "type": "text",
1690
+ "primaryKey": false,
1691
+ "notNull": true
1692
+ },
1693
+ "document_created_at": {
1694
+ "name": "document_created_at",
1695
+ "type": "timestamp",
1696
+ "primaryKey": false,
1697
+ "notNull": true
1698
+ },
1699
+ "original_text": {
1700
+ "name": "original_text",
1701
+ "type": "text",
1702
+ "primaryKey": false,
1703
+ "notNull": true
1704
+ },
1705
+ "suggested_text": {
1706
+ "name": "suggested_text",
1707
+ "type": "text",
1708
+ "primaryKey": false,
1709
+ "notNull": true
1710
+ },
1711
+ "description": {
1712
+ "name": "description",
1713
+ "type": "text",
1714
+ "primaryKey": false,
1715
+ "notNull": false
1716
+ },
1717
+ "is_resolved": {
1718
+ "name": "is_resolved",
1719
+ "type": "boolean",
1720
+ "primaryKey": false,
1721
+ "notNull": true,
1722
+ "default": false
1723
+ },
1724
+ "user_id": {
1725
+ "name": "user_id",
1726
+ "type": "text",
1727
+ "primaryKey": false,
1728
+ "notNull": true
1729
+ },
1730
+ "workspace_id": {
1731
+ "name": "workspace_id",
1732
+ "type": "text",
1733
+ "primaryKey": false,
1734
+ "notNull": true
1735
+ },
1736
+ "created_at": {
1737
+ "name": "created_at",
1738
+ "type": "timestamp",
1739
+ "primaryKey": false,
1740
+ "notNull": true,
1741
+ "default": "now()"
1742
+ }
1743
+ },
1744
+ "indexes": {
1745
+ "suggestions_workspace_id_idx": {
1746
+ "name": "suggestions_workspace_id_idx",
1747
+ "columns": [
1748
+ {
1749
+ "expression": "workspace_id",
1750
+ "isExpression": false,
1751
+ "asc": true,
1752
+ "nulls": "last"
1753
+ }
1754
+ ],
1755
+ "isUnique": false,
1756
+ "concurrently": false,
1757
+ "method": "btree",
1758
+ "with": {}
1759
+ }
1760
+ },
1761
+ "foreignKeys": {
1762
+ "suggestions_user_id_users_id_fk": {
1763
+ "name": "suggestions_user_id_users_id_fk",
1764
+ "tableFrom": "suggestions",
1765
+ "tableTo": "users",
1766
+ "columnsFrom": ["user_id"],
1767
+ "columnsTo": ["id"],
1768
+ "onDelete": "cascade",
1769
+ "onUpdate": "no action"
1770
+ },
1771
+ "suggestions_workspace_id_organization_id_fk": {
1772
+ "name": "suggestions_workspace_id_organization_id_fk",
1773
+ "tableFrom": "suggestions",
1774
+ "tableTo": "organization",
1775
+ "columnsFrom": ["workspace_id"],
1776
+ "columnsTo": ["id"],
1777
+ "onDelete": "cascade",
1778
+ "onUpdate": "no action"
1779
+ }
1780
+ },
1781
+ "compositePrimaryKeys": {},
1782
+ "uniqueConstraints": {},
1783
+ "policies": {},
1784
+ "checkConstraints": {},
1785
+ "isRLSEnabled": false
1786
+ },
1787
+ "public.user_profiles": {
1788
+ "name": "user_profiles",
1789
+ "schema": "",
1790
+ "columns": {
1791
+ "id": {
1792
+ "name": "id",
1793
+ "type": "text",
1794
+ "primaryKey": true,
1795
+ "notNull": true
1796
+ },
1797
+ "user_id": {
1798
+ "name": "user_id",
1799
+ "type": "text",
1800
+ "primaryKey": false,
1801
+ "notNull": true
1802
+ },
1803
+ "workspace_id": {
1804
+ "name": "workspace_id",
1805
+ "type": "text",
1806
+ "primaryKey": false,
1807
+ "notNull": true
1808
+ },
1809
+ "product": {
1810
+ "name": "product",
1811
+ "type": "text",
1812
+ "primaryKey": false,
1813
+ "notNull": true,
1814
+ "default": "'career'"
1815
+ },
1816
+ "interests": {
1817
+ "name": "interests",
1818
+ "type": "text",
1819
+ "primaryKey": false,
1820
+ "notNull": false
1821
+ },
1822
+ "skills": {
1823
+ "name": "skills",
1824
+ "type": "text",
1825
+ "primaryKey": false,
1826
+ "notNull": false
1827
+ },
1828
+ "education": {
1829
+ "name": "education",
1830
+ "type": "text",
1831
+ "primaryKey": false,
1832
+ "notNull": false
1833
+ },
1834
+ "goals": {
1835
+ "name": "goals",
1836
+ "type": "text",
1837
+ "primaryKey": false,
1838
+ "notNull": false
1839
+ },
1840
+ "constraints": {
1841
+ "name": "constraints",
1842
+ "type": "text",
1843
+ "primaryKey": false,
1844
+ "notNull": false
1845
+ },
1846
+ "completed_phases": {
1847
+ "name": "completed_phases",
1848
+ "type": "text",
1849
+ "primaryKey": false,
1850
+ "notNull": false
1851
+ },
1852
+ "last_assessment_at": {
1853
+ "name": "last_assessment_at",
1854
+ "type": "timestamp",
1855
+ "primaryKey": false,
1856
+ "notNull": false
1857
+ },
1858
+ "created_at": {
1859
+ "name": "created_at",
1860
+ "type": "timestamp",
1861
+ "primaryKey": false,
1862
+ "notNull": true,
1863
+ "default": "now()"
1864
+ },
1865
+ "updated_at": {
1866
+ "name": "updated_at",
1867
+ "type": "timestamp",
1868
+ "primaryKey": false,
1869
+ "notNull": true,
1870
+ "default": "now()"
1871
+ }
1872
+ },
1873
+ "indexes": {
1874
+ "user_profiles_user_id_idx": {
1875
+ "name": "user_profiles_user_id_idx",
1876
+ "columns": [
1877
+ {
1878
+ "expression": "user_id",
1879
+ "isExpression": false,
1880
+ "asc": true,
1881
+ "nulls": "last"
1882
+ }
1883
+ ],
1884
+ "isUnique": false,
1885
+ "concurrently": false,
1886
+ "method": "btree",
1887
+ "with": {}
1888
+ },
1889
+ "user_profiles_workspace_user_product_idx": {
1890
+ "name": "user_profiles_workspace_user_product_idx",
1891
+ "columns": [
1892
+ {
1893
+ "expression": "workspace_id",
1894
+ "isExpression": false,
1895
+ "asc": true,
1896
+ "nulls": "last"
1897
+ },
1898
+ {
1899
+ "expression": "user_id",
1900
+ "isExpression": false,
1901
+ "asc": true,
1902
+ "nulls": "last"
1903
+ },
1904
+ {
1905
+ "expression": "product",
1906
+ "isExpression": false,
1907
+ "asc": true,
1908
+ "nulls": "last"
1909
+ }
1910
+ ],
1911
+ "isUnique": true,
1912
+ "concurrently": false,
1913
+ "method": "btree",
1914
+ "with": {}
1915
+ }
1916
+ },
1917
+ "foreignKeys": {
1918
+ "user_profiles_user_id_users_id_fk": {
1919
+ "name": "user_profiles_user_id_users_id_fk",
1920
+ "tableFrom": "user_profiles",
1921
+ "tableTo": "users",
1922
+ "columnsFrom": ["user_id"],
1923
+ "columnsTo": ["id"],
1924
+ "onDelete": "cascade",
1925
+ "onUpdate": "no action"
1926
+ },
1927
+ "user_profiles_workspace_id_organization_id_fk": {
1928
+ "name": "user_profiles_workspace_id_organization_id_fk",
1929
+ "tableFrom": "user_profiles",
1930
+ "tableTo": "organization",
1931
+ "columnsFrom": ["workspace_id"],
1932
+ "columnsTo": ["id"],
1933
+ "onDelete": "cascade",
1934
+ "onUpdate": "no action"
1935
+ }
1936
+ },
1937
+ "compositePrimaryKeys": {},
1938
+ "uniqueConstraints": {},
1939
+ "policies": {},
1940
+ "checkConstraints": {},
1941
+ "isRLSEnabled": false
1942
+ },
1943
+ "public.votes": {
1944
+ "name": "votes",
1945
+ "schema": "",
1946
+ "columns": {
1947
+ "chat_id": {
1948
+ "name": "chat_id",
1949
+ "type": "text",
1950
+ "primaryKey": false,
1951
+ "notNull": true
1952
+ },
1953
+ "message_id": {
1954
+ "name": "message_id",
1955
+ "type": "text",
1956
+ "primaryKey": false,
1957
+ "notNull": true
1958
+ },
1959
+ "is_upvoted": {
1960
+ "name": "is_upvoted",
1961
+ "type": "boolean",
1962
+ "primaryKey": false,
1963
+ "notNull": true
1964
+ }
1965
+ },
1966
+ "indexes": {
1967
+ "votes_message_id_idx": {
1968
+ "name": "votes_message_id_idx",
1969
+ "columns": [
1970
+ {
1971
+ "expression": "message_id",
1972
+ "isExpression": false,
1973
+ "asc": true,
1974
+ "nulls": "last"
1975
+ }
1976
+ ],
1977
+ "isUnique": false,
1978
+ "concurrently": false,
1979
+ "method": "btree",
1980
+ "with": {}
1981
+ }
1982
+ },
1983
+ "foreignKeys": {
1984
+ "votes_chat_id_conversations_id_fk": {
1985
+ "name": "votes_chat_id_conversations_id_fk",
1986
+ "tableFrom": "votes",
1987
+ "tableTo": "conversations",
1988
+ "columnsFrom": ["chat_id"],
1989
+ "columnsTo": ["id"],
1990
+ "onDelete": "cascade",
1991
+ "onUpdate": "no action"
1992
+ },
1993
+ "votes_message_id_messages_id_fk": {
1994
+ "name": "votes_message_id_messages_id_fk",
1995
+ "tableFrom": "votes",
1996
+ "tableTo": "messages",
1997
+ "columnsFrom": ["message_id"],
1998
+ "columnsTo": ["id"],
1999
+ "onDelete": "cascade",
2000
+ "onUpdate": "no action"
2001
+ }
2002
+ },
2003
+ "compositePrimaryKeys": {
2004
+ "votes_chat_id_message_id_pk": {
2005
+ "name": "votes_chat_id_message_id_pk",
2006
+ "columns": ["chat_id", "message_id"]
2007
+ }
2008
+ },
2009
+ "uniqueConstraints": {},
2010
+ "policies": {},
2011
+ "checkConstraints": {},
2012
+ "isRLSEnabled": false
2013
+ },
2014
+ "public.accounts": {
2015
+ "name": "accounts",
2016
+ "schema": "",
2017
+ "columns": {
2018
+ "id": {
2019
+ "name": "id",
2020
+ "type": "text",
2021
+ "primaryKey": true,
2022
+ "notNull": true
2023
+ },
2024
+ "user_id": {
2025
+ "name": "user_id",
2026
+ "type": "text",
2027
+ "primaryKey": false,
2028
+ "notNull": true
2029
+ },
2030
+ "account_id": {
2031
+ "name": "account_id",
2032
+ "type": "text",
2033
+ "primaryKey": false,
2034
+ "notNull": true
2035
+ },
2036
+ "provider_id": {
2037
+ "name": "provider_id",
2038
+ "type": "text",
2039
+ "primaryKey": false,
2040
+ "notNull": true
2041
+ },
2042
+ "access_token": {
2043
+ "name": "access_token",
2044
+ "type": "text",
2045
+ "primaryKey": false,
2046
+ "notNull": false
2047
+ },
2048
+ "refresh_token": {
2049
+ "name": "refresh_token",
2050
+ "type": "text",
2051
+ "primaryKey": false,
2052
+ "notNull": false
2053
+ },
2054
+ "access_token_expires_at": {
2055
+ "name": "access_token_expires_at",
2056
+ "type": "timestamp",
2057
+ "primaryKey": false,
2058
+ "notNull": false
2059
+ },
2060
+ "refresh_token_expires_at": {
2061
+ "name": "refresh_token_expires_at",
2062
+ "type": "timestamp",
2063
+ "primaryKey": false,
2064
+ "notNull": false
2065
+ },
2066
+ "scope": {
2067
+ "name": "scope",
2068
+ "type": "text",
2069
+ "primaryKey": false,
2070
+ "notNull": false
2071
+ },
2072
+ "id_token": {
2073
+ "name": "id_token",
2074
+ "type": "text",
2075
+ "primaryKey": false,
2076
+ "notNull": false
2077
+ },
2078
+ "password": {
2079
+ "name": "password",
2080
+ "type": "text",
2081
+ "primaryKey": false,
2082
+ "notNull": false
2083
+ },
2084
+ "created_at": {
2085
+ "name": "created_at",
2086
+ "type": "timestamp",
2087
+ "primaryKey": false,
2088
+ "notNull": true,
2089
+ "default": "now()"
2090
+ },
2091
+ "updated_at": {
2092
+ "name": "updated_at",
2093
+ "type": "timestamp",
2094
+ "primaryKey": false,
2095
+ "notNull": true,
2096
+ "default": "now()"
2097
+ }
2098
+ },
2099
+ "indexes": {
2100
+ "accounts_user_id_idx": {
2101
+ "name": "accounts_user_id_idx",
2102
+ "columns": [
2103
+ {
2104
+ "expression": "user_id",
2105
+ "isExpression": false,
2106
+ "asc": true,
2107
+ "nulls": "last"
2108
+ }
2109
+ ],
2110
+ "isUnique": false,
2111
+ "concurrently": false,
2112
+ "method": "btree",
2113
+ "with": {}
2114
+ }
2115
+ },
2116
+ "foreignKeys": {
2117
+ "accounts_user_id_users_id_fk": {
2118
+ "name": "accounts_user_id_users_id_fk",
2119
+ "tableFrom": "accounts",
2120
+ "tableTo": "users",
2121
+ "columnsFrom": ["user_id"],
2122
+ "columnsTo": ["id"],
2123
+ "onDelete": "cascade",
2124
+ "onUpdate": "no action"
2125
+ }
2126
+ },
2127
+ "compositePrimaryKeys": {},
2128
+ "uniqueConstraints": {},
2129
+ "policies": {},
2130
+ "checkConstraints": {},
2131
+ "isRLSEnabled": false
2132
+ },
2133
+ "public.invitation": {
2134
+ "name": "invitation",
2135
+ "schema": "",
2136
+ "columns": {
2137
+ "id": {
2138
+ "name": "id",
2139
+ "type": "text",
2140
+ "primaryKey": true,
2141
+ "notNull": true
2142
+ },
2143
+ "organization_id": {
2144
+ "name": "organization_id",
2145
+ "type": "text",
2146
+ "primaryKey": false,
2147
+ "notNull": true
2148
+ },
2149
+ "email": {
2150
+ "name": "email",
2151
+ "type": "text",
2152
+ "primaryKey": false,
2153
+ "notNull": true
2154
+ },
2155
+ "role": {
2156
+ "name": "role",
2157
+ "type": "text",
2158
+ "primaryKey": false,
2159
+ "notNull": true
2160
+ },
2161
+ "status": {
2162
+ "name": "status",
2163
+ "type": "text",
2164
+ "primaryKey": false,
2165
+ "notNull": true
2166
+ },
2167
+ "expires_at": {
2168
+ "name": "expires_at",
2169
+ "type": "timestamp",
2170
+ "primaryKey": false,
2171
+ "notNull": true
2172
+ },
2173
+ "inviter_id": {
2174
+ "name": "inviter_id",
2175
+ "type": "text",
2176
+ "primaryKey": false,
2177
+ "notNull": true
2178
+ },
2179
+ "created_at": {
2180
+ "name": "created_at",
2181
+ "type": "timestamp",
2182
+ "primaryKey": false,
2183
+ "notNull": true,
2184
+ "default": "now()"
2185
+ },
2186
+ "updated_at": {
2187
+ "name": "updated_at",
2188
+ "type": "timestamp",
2189
+ "primaryKey": false,
2190
+ "notNull": true,
2191
+ "default": "now()"
2192
+ }
2193
+ },
2194
+ "indexes": {
2195
+ "invitation_organization_id_idx": {
2196
+ "name": "invitation_organization_id_idx",
2197
+ "columns": [
2198
+ {
2199
+ "expression": "organization_id",
2200
+ "isExpression": false,
2201
+ "asc": true,
2202
+ "nulls": "last"
2203
+ }
2204
+ ],
2205
+ "isUnique": false,
2206
+ "concurrently": false,
2207
+ "method": "btree",
2208
+ "with": {}
2209
+ },
2210
+ "invitation_email_idx": {
2211
+ "name": "invitation_email_idx",
2212
+ "columns": [
2213
+ {
2214
+ "expression": "email",
2215
+ "isExpression": false,
2216
+ "asc": true,
2217
+ "nulls": "last"
2218
+ }
2219
+ ],
2220
+ "isUnique": false,
2221
+ "concurrently": false,
2222
+ "method": "btree",
2223
+ "with": {}
2224
+ }
2225
+ },
2226
+ "foreignKeys": {
2227
+ "invitation_organization_id_organization_id_fk": {
2228
+ "name": "invitation_organization_id_organization_id_fk",
2229
+ "tableFrom": "invitation",
2230
+ "tableTo": "organization",
2231
+ "columnsFrom": ["organization_id"],
2232
+ "columnsTo": ["id"],
2233
+ "onDelete": "cascade",
2234
+ "onUpdate": "no action"
2235
+ },
2236
+ "invitation_inviter_id_users_id_fk": {
2237
+ "name": "invitation_inviter_id_users_id_fk",
2238
+ "tableFrom": "invitation",
2239
+ "tableTo": "users",
2240
+ "columnsFrom": ["inviter_id"],
2241
+ "columnsTo": ["id"],
2242
+ "onDelete": "no action",
2243
+ "onUpdate": "no action"
2244
+ }
2245
+ },
2246
+ "compositePrimaryKeys": {},
2247
+ "uniqueConstraints": {},
2248
+ "policies": {},
2249
+ "checkConstraints": {},
2250
+ "isRLSEnabled": false
2251
+ },
2252
+ "public.member": {
2253
+ "name": "member",
2254
+ "schema": "",
2255
+ "columns": {
2256
+ "id": {
2257
+ "name": "id",
2258
+ "type": "text",
2259
+ "primaryKey": true,
2260
+ "notNull": true
2261
+ },
2262
+ "organization_id": {
2263
+ "name": "organization_id",
2264
+ "type": "text",
2265
+ "primaryKey": false,
2266
+ "notNull": true
2267
+ },
2268
+ "user_id": {
2269
+ "name": "user_id",
2270
+ "type": "text",
2271
+ "primaryKey": false,
2272
+ "notNull": true
2273
+ },
2274
+ "role": {
2275
+ "name": "role",
2276
+ "type": "text",
2277
+ "primaryKey": false,
2278
+ "notNull": true
2279
+ },
2280
+ "created_at": {
2281
+ "name": "created_at",
2282
+ "type": "timestamp",
2283
+ "primaryKey": false,
2284
+ "notNull": true,
2285
+ "default": "now()"
2286
+ },
2287
+ "updated_at": {
2288
+ "name": "updated_at",
2289
+ "type": "timestamp",
2290
+ "primaryKey": false,
2291
+ "notNull": true,
2292
+ "default": "now()"
2293
+ }
2294
+ },
2295
+ "indexes": {
2296
+ "member_organization_id_idx": {
2297
+ "name": "member_organization_id_idx",
2298
+ "columns": [
2299
+ {
2300
+ "expression": "organization_id",
2301
+ "isExpression": false,
2302
+ "asc": true,
2303
+ "nulls": "last"
2304
+ }
2305
+ ],
2306
+ "isUnique": false,
2307
+ "concurrently": false,
2308
+ "method": "btree",
2309
+ "with": {}
2310
+ },
2311
+ "member_user_id_idx": {
2312
+ "name": "member_user_id_idx",
2313
+ "columns": [
2314
+ {
2315
+ "expression": "user_id",
2316
+ "isExpression": false,
2317
+ "asc": true,
2318
+ "nulls": "last"
2319
+ }
2320
+ ],
2321
+ "isUnique": false,
2322
+ "concurrently": false,
2323
+ "method": "btree",
2324
+ "with": {}
2325
+ }
2326
+ },
2327
+ "foreignKeys": {
2328
+ "member_organization_id_organization_id_fk": {
2329
+ "name": "member_organization_id_organization_id_fk",
2330
+ "tableFrom": "member",
2331
+ "tableTo": "organization",
2332
+ "columnsFrom": ["organization_id"],
2333
+ "columnsTo": ["id"],
2334
+ "onDelete": "cascade",
2335
+ "onUpdate": "no action"
2336
+ },
2337
+ "member_user_id_users_id_fk": {
2338
+ "name": "member_user_id_users_id_fk",
2339
+ "tableFrom": "member",
2340
+ "tableTo": "users",
2341
+ "columnsFrom": ["user_id"],
2342
+ "columnsTo": ["id"],
2343
+ "onDelete": "cascade",
2344
+ "onUpdate": "no action"
2345
+ }
2346
+ },
2347
+ "compositePrimaryKeys": {},
2348
+ "uniqueConstraints": {},
2349
+ "policies": {},
2350
+ "checkConstraints": {},
2351
+ "isRLSEnabled": false
2352
+ },
2353
+ "public.organization": {
2354
+ "name": "organization",
2355
+ "schema": "",
2356
+ "columns": {
2357
+ "id": {
2358
+ "name": "id",
2359
+ "type": "text",
2360
+ "primaryKey": true,
2361
+ "notNull": true
2362
+ },
2363
+ "name": {
2364
+ "name": "name",
2365
+ "type": "text",
2366
+ "primaryKey": false,
2367
+ "notNull": true
2368
+ },
2369
+ "slug": {
2370
+ "name": "slug",
2371
+ "type": "text",
2372
+ "primaryKey": false,
2373
+ "notNull": false
2374
+ },
2375
+ "logo": {
2376
+ "name": "logo",
2377
+ "type": "text",
2378
+ "primaryKey": false,
2379
+ "notNull": false
2380
+ },
2381
+ "metadata": {
2382
+ "name": "metadata",
2383
+ "type": "text",
2384
+ "primaryKey": false,
2385
+ "notNull": false
2386
+ },
2387
+ "created_at": {
2388
+ "name": "created_at",
2389
+ "type": "timestamp",
2390
+ "primaryKey": false,
2391
+ "notNull": true,
2392
+ "default": "now()"
2393
+ },
2394
+ "updated_at": {
2395
+ "name": "updated_at",
2396
+ "type": "timestamp",
2397
+ "primaryKey": false,
2398
+ "notNull": true,
2399
+ "default": "now()"
2400
+ }
2401
+ },
2402
+ "indexes": {},
2403
+ "foreignKeys": {},
2404
+ "compositePrimaryKeys": {},
2405
+ "uniqueConstraints": {
2406
+ "organization_slug_unique": {
2407
+ "name": "organization_slug_unique",
2408
+ "nullsNotDistinct": false,
2409
+ "columns": ["slug"]
2410
+ }
2411
+ },
2412
+ "policies": {},
2413
+ "checkConstraints": {},
2414
+ "isRLSEnabled": false
2415
+ },
2416
+ "public.sessions": {
2417
+ "name": "sessions",
2418
+ "schema": "",
2419
+ "columns": {
2420
+ "id": {
2421
+ "name": "id",
2422
+ "type": "text",
2423
+ "primaryKey": true,
2424
+ "notNull": true
2425
+ },
2426
+ "user_id": {
2427
+ "name": "user_id",
2428
+ "type": "text",
2429
+ "primaryKey": false,
2430
+ "notNull": true
2431
+ },
2432
+ "token": {
2433
+ "name": "token",
2434
+ "type": "text",
2435
+ "primaryKey": false,
2436
+ "notNull": true
2437
+ },
2438
+ "expires_at": {
2439
+ "name": "expires_at",
2440
+ "type": "timestamp",
2441
+ "primaryKey": false,
2442
+ "notNull": true
2443
+ },
2444
+ "ip_address": {
2445
+ "name": "ip_address",
2446
+ "type": "text",
2447
+ "primaryKey": false,
2448
+ "notNull": false
2449
+ },
2450
+ "user_agent": {
2451
+ "name": "user_agent",
2452
+ "type": "text",
2453
+ "primaryKey": false,
2454
+ "notNull": false
2455
+ },
2456
+ "created_at": {
2457
+ "name": "created_at",
2458
+ "type": "timestamp",
2459
+ "primaryKey": false,
2460
+ "notNull": true,
2461
+ "default": "now()"
2462
+ },
2463
+ "updated_at": {
2464
+ "name": "updated_at",
2465
+ "type": "timestamp",
2466
+ "primaryKey": false,
2467
+ "notNull": true,
2468
+ "default": "now()"
2469
+ }
2470
+ },
2471
+ "indexes": {
2472
+ "sessions_user_id_idx": {
2473
+ "name": "sessions_user_id_idx",
2474
+ "columns": [
2475
+ {
2476
+ "expression": "user_id",
2477
+ "isExpression": false,
2478
+ "asc": true,
2479
+ "nulls": "last"
2480
+ }
2481
+ ],
2482
+ "isUnique": false,
2483
+ "concurrently": false,
2484
+ "method": "btree",
2485
+ "with": {}
2486
+ }
2487
+ },
2488
+ "foreignKeys": {
2489
+ "sessions_user_id_users_id_fk": {
2490
+ "name": "sessions_user_id_users_id_fk",
2491
+ "tableFrom": "sessions",
2492
+ "tableTo": "users",
2493
+ "columnsFrom": ["user_id"],
2494
+ "columnsTo": ["id"],
2495
+ "onDelete": "cascade",
2496
+ "onUpdate": "no action"
2497
+ }
2498
+ },
2499
+ "compositePrimaryKeys": {},
2500
+ "uniqueConstraints": {
2501
+ "sessions_token_unique": {
2502
+ "name": "sessions_token_unique",
2503
+ "nullsNotDistinct": false,
2504
+ "columns": ["token"]
2505
+ }
2506
+ },
2507
+ "policies": {},
2508
+ "checkConstraints": {},
2509
+ "isRLSEnabled": false
2510
+ },
2511
+ "public.users": {
2512
+ "name": "users",
2513
+ "schema": "",
2514
+ "columns": {
2515
+ "id": {
2516
+ "name": "id",
2517
+ "type": "text",
2518
+ "primaryKey": true,
2519
+ "notNull": true
2520
+ },
2521
+ "name": {
2522
+ "name": "name",
2523
+ "type": "text",
2524
+ "primaryKey": false,
2525
+ "notNull": true
2526
+ },
2527
+ "email": {
2528
+ "name": "email",
2529
+ "type": "text",
2530
+ "primaryKey": false,
2531
+ "notNull": true
2532
+ },
2533
+ "email_verified": {
2534
+ "name": "email_verified",
2535
+ "type": "boolean",
2536
+ "primaryKey": false,
2537
+ "notNull": true,
2538
+ "default": false
2539
+ },
2540
+ "image": {
2541
+ "name": "image",
2542
+ "type": "text",
2543
+ "primaryKey": false,
2544
+ "notNull": false
2545
+ },
2546
+ "deleted_at": {
2547
+ "name": "deleted_at",
2548
+ "type": "timestamp",
2549
+ "primaryKey": false,
2550
+ "notNull": false
2551
+ },
2552
+ "created_at": {
2553
+ "name": "created_at",
2554
+ "type": "timestamp",
2555
+ "primaryKey": false,
2556
+ "notNull": true,
2557
+ "default": "now()"
2558
+ },
2559
+ "updated_at": {
2560
+ "name": "updated_at",
2561
+ "type": "timestamp",
2562
+ "primaryKey": false,
2563
+ "notNull": true,
2564
+ "default": "now()"
2565
+ },
2566
+ "onboarding_completed": {
2567
+ "name": "onboarding_completed",
2568
+ "type": "boolean",
2569
+ "primaryKey": false,
2570
+ "notNull": true,
2571
+ "default": false
2572
+ },
2573
+ "onboarding_step": {
2574
+ "name": "onboarding_step",
2575
+ "type": "text",
2576
+ "primaryKey": false,
2577
+ "notNull": false
2578
+ },
2579
+ "preferred_language": {
2580
+ "name": "preferred_language",
2581
+ "type": "text",
2582
+ "primaryKey": false,
2583
+ "notNull": true,
2584
+ "default": "'en'"
2585
+ }
2586
+ },
2587
+ "indexes": {},
2588
+ "foreignKeys": {},
2589
+ "compositePrimaryKeys": {},
2590
+ "uniqueConstraints": {
2591
+ "users_email_unique": {
2592
+ "name": "users_email_unique",
2593
+ "nullsNotDistinct": false,
2594
+ "columns": ["email"]
2595
+ }
2596
+ },
2597
+ "policies": {},
2598
+ "checkConstraints": {},
2599
+ "isRLSEnabled": false
2600
+ },
2601
+ "public.verifications": {
2602
+ "name": "verifications",
2603
+ "schema": "",
2604
+ "columns": {
2605
+ "id": {
2606
+ "name": "id",
2607
+ "type": "text",
2608
+ "primaryKey": true,
2609
+ "notNull": true
2610
+ },
2611
+ "identifier": {
2612
+ "name": "identifier",
2613
+ "type": "text",
2614
+ "primaryKey": false,
2615
+ "notNull": true
2616
+ },
2617
+ "value": {
2618
+ "name": "value",
2619
+ "type": "text",
2620
+ "primaryKey": false,
2621
+ "notNull": true
2622
+ },
2623
+ "expires_at": {
2624
+ "name": "expires_at",
2625
+ "type": "timestamp",
2626
+ "primaryKey": false,
2627
+ "notNull": true
2628
+ },
2629
+ "created_at": {
2630
+ "name": "created_at",
2631
+ "type": "timestamp",
2632
+ "primaryKey": false,
2633
+ "notNull": true,
2634
+ "default": "now()"
2635
+ },
2636
+ "updated_at": {
2637
+ "name": "updated_at",
2638
+ "type": "timestamp",
2639
+ "primaryKey": false,
2640
+ "notNull": true,
2641
+ "default": "now()"
2642
+ }
2643
+ },
2644
+ "indexes": {},
2645
+ "foreignKeys": {},
2646
+ "compositePrimaryKeys": {},
2647
+ "uniqueConstraints": {},
2648
+ "policies": {},
2649
+ "checkConstraints": {},
2650
+ "isRLSEnabled": false
2651
+ },
2652
+ "public.credit_balances": {
2653
+ "name": "credit_balances",
2654
+ "schema": "",
2655
+ "columns": {
2656
+ "id": {
2657
+ "name": "id",
2658
+ "type": "text",
2659
+ "primaryKey": true,
2660
+ "notNull": true
2661
+ },
2662
+ "workspace_id": {
2663
+ "name": "workspace_id",
2664
+ "type": "text",
2665
+ "primaryKey": false,
2666
+ "notNull": true
2667
+ },
2668
+ "balance": {
2669
+ "name": "balance",
2670
+ "type": "integer",
2671
+ "primaryKey": false,
2672
+ "notNull": true,
2673
+ "default": 0
2674
+ },
2675
+ "total_purchased": {
2676
+ "name": "total_purchased",
2677
+ "type": "integer",
2678
+ "primaryKey": false,
2679
+ "notNull": true,
2680
+ "default": 0
2681
+ },
2682
+ "total_used": {
2683
+ "name": "total_used",
2684
+ "type": "integer",
2685
+ "primaryKey": false,
2686
+ "notNull": true,
2687
+ "default": 0
2688
+ },
2689
+ "updated_at": {
2690
+ "name": "updated_at",
2691
+ "type": "timestamp",
2692
+ "primaryKey": false,
2693
+ "notNull": true,
2694
+ "default": "now()"
2695
+ }
2696
+ },
2697
+ "indexes": {},
2698
+ "foreignKeys": {
2699
+ "credit_balances_workspace_id_organization_id_fk": {
2700
+ "name": "credit_balances_workspace_id_organization_id_fk",
2701
+ "tableFrom": "credit_balances",
2702
+ "tableTo": "organization",
2703
+ "columnsFrom": ["workspace_id"],
2704
+ "columnsTo": ["id"],
2705
+ "onDelete": "cascade",
2706
+ "onUpdate": "no action"
2707
+ }
2708
+ },
2709
+ "compositePrimaryKeys": {},
2710
+ "uniqueConstraints": {
2711
+ "credit_balances_workspace_id_unique": {
2712
+ "name": "credit_balances_workspace_id_unique",
2713
+ "nullsNotDistinct": false,
2714
+ "columns": ["workspace_id"]
2715
+ }
2716
+ },
2717
+ "policies": {},
2718
+ "checkConstraints": {},
2719
+ "isRLSEnabled": false
2720
+ },
2721
+ "public.credit_purchases": {
2722
+ "name": "credit_purchases",
2723
+ "schema": "",
2724
+ "columns": {
2725
+ "id": {
2726
+ "name": "id",
2727
+ "type": "text",
2728
+ "primaryKey": true,
2729
+ "notNull": true
2730
+ },
2731
+ "workspace_id": {
2732
+ "name": "workspace_id",
2733
+ "type": "text",
2734
+ "primaryKey": false,
2735
+ "notNull": true
2736
+ },
2737
+ "amount": {
2738
+ "name": "amount",
2739
+ "type": "integer",
2740
+ "primaryKey": false,
2741
+ "notNull": true
2742
+ },
2743
+ "credits": {
2744
+ "name": "credits",
2745
+ "type": "integer",
2746
+ "primaryKey": false,
2747
+ "notNull": true
2748
+ },
2749
+ "stripe_payment_intent_id": {
2750
+ "name": "stripe_payment_intent_id",
2751
+ "type": "text",
2752
+ "primaryKey": false,
2753
+ "notNull": false
2754
+ },
2755
+ "stripe_checkout_session_id": {
2756
+ "name": "stripe_checkout_session_id",
2757
+ "type": "text",
2758
+ "primaryKey": false,
2759
+ "notNull": false
2760
+ },
2761
+ "status": {
2762
+ "name": "status",
2763
+ "type": "text",
2764
+ "primaryKey": false,
2765
+ "notNull": true,
2766
+ "default": "'pending'"
2767
+ },
2768
+ "created_at": {
2769
+ "name": "created_at",
2770
+ "type": "timestamp",
2771
+ "primaryKey": false,
2772
+ "notNull": true,
2773
+ "default": "now()"
2774
+ }
2775
+ },
2776
+ "indexes": {
2777
+ "credit_purchases_workspace_id_idx": {
2778
+ "name": "credit_purchases_workspace_id_idx",
2779
+ "columns": [
2780
+ {
2781
+ "expression": "workspace_id",
2782
+ "isExpression": false,
2783
+ "asc": true,
2784
+ "nulls": "last"
2785
+ }
2786
+ ],
2787
+ "isUnique": false,
2788
+ "concurrently": false,
2789
+ "method": "btree",
2790
+ "with": {}
2791
+ }
2792
+ },
2793
+ "foreignKeys": {
2794
+ "credit_purchases_workspace_id_organization_id_fk": {
2795
+ "name": "credit_purchases_workspace_id_organization_id_fk",
2796
+ "tableFrom": "credit_purchases",
2797
+ "tableTo": "organization",
2798
+ "columnsFrom": ["workspace_id"],
2799
+ "columnsTo": ["id"],
2800
+ "onDelete": "cascade",
2801
+ "onUpdate": "no action"
2802
+ }
2803
+ },
2804
+ "compositePrimaryKeys": {},
2805
+ "uniqueConstraints": {},
2806
+ "policies": {},
2807
+ "checkConstraints": {},
2808
+ "isRLSEnabled": false
2809
+ },
2810
+ "public.finance_events": {
2811
+ "name": "finance_events",
2812
+ "schema": "",
2813
+ "columns": {
2814
+ "id": {
2815
+ "name": "id",
2816
+ "type": "text",
2817
+ "primaryKey": true,
2818
+ "notNull": true
2819
+ },
2820
+ "workspace_id": {
2821
+ "name": "workspace_id",
2822
+ "type": "text",
2823
+ "primaryKey": false,
2824
+ "notNull": false
2825
+ },
2826
+ "stripe_event_id": {
2827
+ "name": "stripe_event_id",
2828
+ "type": "text",
2829
+ "primaryKey": false,
2830
+ "notNull": true
2831
+ },
2832
+ "type": {
2833
+ "name": "type",
2834
+ "type": "text",
2835
+ "primaryKey": false,
2836
+ "notNull": true
2837
+ },
2838
+ "amount": {
2839
+ "name": "amount",
2840
+ "type": "integer",
2841
+ "primaryKey": false,
2842
+ "notNull": false
2843
+ },
2844
+ "currency": {
2845
+ "name": "currency",
2846
+ "type": "text",
2847
+ "primaryKey": false,
2848
+ "notNull": false,
2849
+ "default": "'usd'"
2850
+ },
2851
+ "metadata": {
2852
+ "name": "metadata",
2853
+ "type": "text",
2854
+ "primaryKey": false,
2855
+ "notNull": false
2856
+ },
2857
+ "processed_at": {
2858
+ "name": "processed_at",
2859
+ "type": "timestamp",
2860
+ "primaryKey": false,
2861
+ "notNull": false
2862
+ },
2863
+ "created_at": {
2864
+ "name": "created_at",
2865
+ "type": "timestamp",
2866
+ "primaryKey": false,
2867
+ "notNull": true,
2868
+ "default": "now()"
2869
+ }
2870
+ },
2871
+ "indexes": {},
2872
+ "foreignKeys": {
2873
+ "finance_events_workspace_id_organization_id_fk": {
2874
+ "name": "finance_events_workspace_id_organization_id_fk",
2875
+ "tableFrom": "finance_events",
2876
+ "tableTo": "organization",
2877
+ "columnsFrom": ["workspace_id"],
2878
+ "columnsTo": ["id"],
2879
+ "onDelete": "no action",
2880
+ "onUpdate": "no action"
2881
+ }
2882
+ },
2883
+ "compositePrimaryKeys": {},
2884
+ "uniqueConstraints": {
2885
+ "finance_events_stripe_event_id_unique": {
2886
+ "name": "finance_events_stripe_event_id_unique",
2887
+ "nullsNotDistinct": false,
2888
+ "columns": ["stripe_event_id"]
2889
+ }
2890
+ },
2891
+ "policies": {},
2892
+ "checkConstraints": {},
2893
+ "isRLSEnabled": false
2894
+ },
2895
+ "public.plans": {
2896
+ "name": "plans",
2897
+ "schema": "",
2898
+ "columns": {
2899
+ "id": {
2900
+ "name": "id",
2901
+ "type": "text",
2902
+ "primaryKey": true,
2903
+ "notNull": true
2904
+ },
2905
+ "name": {
2906
+ "name": "name",
2907
+ "type": "text",
2908
+ "primaryKey": false,
2909
+ "notNull": true
2910
+ },
2911
+ "slug": {
2912
+ "name": "slug",
2913
+ "type": "text",
2914
+ "primaryKey": false,
2915
+ "notNull": true
2916
+ },
2917
+ "description": {
2918
+ "name": "description",
2919
+ "type": "text",
2920
+ "primaryKey": false,
2921
+ "notNull": false
2922
+ },
2923
+ "price_monthly": {
2924
+ "name": "price_monthly",
2925
+ "type": "integer",
2926
+ "primaryKey": false,
2927
+ "notNull": true
2928
+ },
2929
+ "price_yearly": {
2930
+ "name": "price_yearly",
2931
+ "type": "integer",
2932
+ "primaryKey": false,
2933
+ "notNull": true
2934
+ },
2935
+ "stripe_price_id_monthly": {
2936
+ "name": "stripe_price_id_monthly",
2937
+ "type": "text",
2938
+ "primaryKey": false,
2939
+ "notNull": false
2940
+ },
2941
+ "stripe_price_id_yearly": {
2942
+ "name": "stripe_price_id_yearly",
2943
+ "type": "text",
2944
+ "primaryKey": false,
2945
+ "notNull": false
2946
+ },
2947
+ "features": {
2948
+ "name": "features",
2949
+ "type": "text",
2950
+ "primaryKey": false,
2951
+ "notNull": true
2952
+ },
2953
+ "limits": {
2954
+ "name": "limits",
2955
+ "type": "text",
2956
+ "primaryKey": false,
2957
+ "notNull": true
2958
+ },
2959
+ "is_active": {
2960
+ "name": "is_active",
2961
+ "type": "boolean",
2962
+ "primaryKey": false,
2963
+ "notNull": true,
2964
+ "default": true
2965
+ },
2966
+ "sort_order": {
2967
+ "name": "sort_order",
2968
+ "type": "integer",
2969
+ "primaryKey": false,
2970
+ "notNull": true,
2971
+ "default": 0
2972
+ },
2973
+ "created_at": {
2974
+ "name": "created_at",
2975
+ "type": "timestamp",
2976
+ "primaryKey": false,
2977
+ "notNull": true,
2978
+ "default": "now()"
2979
+ },
2980
+ "updated_at": {
2981
+ "name": "updated_at",
2982
+ "type": "timestamp",
2983
+ "primaryKey": false,
2984
+ "notNull": true,
2985
+ "default": "now()"
2986
+ }
2987
+ },
2988
+ "indexes": {},
2989
+ "foreignKeys": {},
2990
+ "compositePrimaryKeys": {},
2991
+ "uniqueConstraints": {
2992
+ "plans_slug_unique": {
2993
+ "name": "plans_slug_unique",
2994
+ "nullsNotDistinct": false,
2995
+ "columns": ["slug"]
2996
+ }
2997
+ },
2998
+ "policies": {},
2999
+ "checkConstraints": {},
3000
+ "isRLSEnabled": false
3001
+ },
3002
+ "public.subscriptions": {
3003
+ "name": "subscriptions",
3004
+ "schema": "",
3005
+ "columns": {
3006
+ "id": {
3007
+ "name": "id",
3008
+ "type": "text",
3009
+ "primaryKey": true,
3010
+ "notNull": true
3011
+ },
3012
+ "workspace_id": {
3013
+ "name": "workspace_id",
3014
+ "type": "text",
3015
+ "primaryKey": false,
3016
+ "notNull": true
3017
+ },
3018
+ "plan_id": {
3019
+ "name": "plan_id",
3020
+ "type": "text",
3021
+ "primaryKey": false,
3022
+ "notNull": true
3023
+ },
3024
+ "stripe_customer_id": {
3025
+ "name": "stripe_customer_id",
3026
+ "type": "text",
3027
+ "primaryKey": false,
3028
+ "notNull": false
3029
+ },
3030
+ "stripe_subscription_id": {
3031
+ "name": "stripe_subscription_id",
3032
+ "type": "text",
3033
+ "primaryKey": false,
3034
+ "notNull": false
3035
+ },
3036
+ "status": {
3037
+ "name": "status",
3038
+ "type": "text",
3039
+ "primaryKey": false,
3040
+ "notNull": true,
3041
+ "default": "'active'"
3042
+ },
3043
+ "billing_mode": {
3044
+ "name": "billing_mode",
3045
+ "type": "text",
3046
+ "primaryKey": false,
3047
+ "notNull": true,
3048
+ "default": "'subscription'"
3049
+ },
3050
+ "current_period_start": {
3051
+ "name": "current_period_start",
3052
+ "type": "timestamp",
3053
+ "primaryKey": false,
3054
+ "notNull": false
3055
+ },
3056
+ "current_period_end": {
3057
+ "name": "current_period_end",
3058
+ "type": "timestamp",
3059
+ "primaryKey": false,
3060
+ "notNull": false
3061
+ },
3062
+ "cancel_at_period_end": {
3063
+ "name": "cancel_at_period_end",
3064
+ "type": "boolean",
3065
+ "primaryKey": false,
3066
+ "notNull": true,
3067
+ "default": false
3068
+ },
3069
+ "created_at": {
3070
+ "name": "created_at",
3071
+ "type": "timestamp",
3072
+ "primaryKey": false,
3073
+ "notNull": true,
3074
+ "default": "now()"
3075
+ },
3076
+ "updated_at": {
3077
+ "name": "updated_at",
3078
+ "type": "timestamp",
3079
+ "primaryKey": false,
3080
+ "notNull": true,
3081
+ "default": "now()"
3082
+ }
3083
+ },
3084
+ "indexes": {
3085
+ "subscriptions_workspace_id_idx": {
3086
+ "name": "subscriptions_workspace_id_idx",
3087
+ "columns": [
3088
+ {
3089
+ "expression": "workspace_id",
3090
+ "isExpression": false,
3091
+ "asc": true,
3092
+ "nulls": "last"
3093
+ }
3094
+ ],
3095
+ "isUnique": false,
3096
+ "concurrently": false,
3097
+ "method": "btree",
3098
+ "with": {}
3099
+ }
3100
+ },
3101
+ "foreignKeys": {
3102
+ "subscriptions_workspace_id_organization_id_fk": {
3103
+ "name": "subscriptions_workspace_id_organization_id_fk",
3104
+ "tableFrom": "subscriptions",
3105
+ "tableTo": "organization",
3106
+ "columnsFrom": ["workspace_id"],
3107
+ "columnsTo": ["id"],
3108
+ "onDelete": "cascade",
3109
+ "onUpdate": "no action"
3110
+ },
3111
+ "subscriptions_plan_id_plans_id_fk": {
3112
+ "name": "subscriptions_plan_id_plans_id_fk",
3113
+ "tableFrom": "subscriptions",
3114
+ "tableTo": "plans",
3115
+ "columnsFrom": ["plan_id"],
3116
+ "columnsTo": ["id"],
3117
+ "onDelete": "restrict",
3118
+ "onUpdate": "no action"
3119
+ }
3120
+ },
3121
+ "compositePrimaryKeys": {},
3122
+ "uniqueConstraints": {
3123
+ "subscriptions_stripe_subscription_id_unique": {
3124
+ "name": "subscriptions_stripe_subscription_id_unique",
3125
+ "nullsNotDistinct": false,
3126
+ "columns": ["stripe_subscription_id"]
3127
+ },
3128
+ "subscriptions_workspace_id_unique": {
3129
+ "name": "subscriptions_workspace_id_unique",
3130
+ "nullsNotDistinct": false,
3131
+ "columns": ["workspace_id"]
3132
+ }
3133
+ },
3134
+ "policies": {},
3135
+ "checkConstraints": {},
3136
+ "isRLSEnabled": false
3137
+ },
3138
+ "public.feature_flags": {
3139
+ "name": "feature_flags",
3140
+ "schema": "",
3141
+ "columns": {
3142
+ "id": {
3143
+ "name": "id",
3144
+ "type": "text",
3145
+ "primaryKey": true,
3146
+ "notNull": true
3147
+ },
3148
+ "name": {
3149
+ "name": "name",
3150
+ "type": "text",
3151
+ "primaryKey": false,
3152
+ "notNull": true
3153
+ },
3154
+ "description": {
3155
+ "name": "description",
3156
+ "type": "text",
3157
+ "primaryKey": false,
3158
+ "notNull": false
3159
+ },
3160
+ "enabled_plans": {
3161
+ "name": "enabled_plans",
3162
+ "type": "text",
3163
+ "primaryKey": false,
3164
+ "notNull": true
3165
+ },
3166
+ "is_active": {
3167
+ "name": "is_active",
3168
+ "type": "boolean",
3169
+ "primaryKey": false,
3170
+ "notNull": true,
3171
+ "default": true
3172
+ },
3173
+ "created_at": {
3174
+ "name": "created_at",
3175
+ "type": "timestamp",
3176
+ "primaryKey": false,
3177
+ "notNull": true,
3178
+ "default": "now()"
3179
+ },
3180
+ "updated_at": {
3181
+ "name": "updated_at",
3182
+ "type": "timestamp",
3183
+ "primaryKey": false,
3184
+ "notNull": true,
3185
+ "default": "now()"
3186
+ }
3187
+ },
3188
+ "indexes": {},
3189
+ "foreignKeys": {},
3190
+ "compositePrimaryKeys": {},
3191
+ "uniqueConstraints": {
3192
+ "feature_flags_name_unique": {
3193
+ "name": "feature_flags_name_unique",
3194
+ "nullsNotDistinct": false,
3195
+ "columns": ["name"]
3196
+ }
3197
+ },
3198
+ "policies": {},
3199
+ "checkConstraints": {},
3200
+ "isRLSEnabled": false
3201
+ },
3202
+ "public.monthly_usage": {
3203
+ "name": "monthly_usage",
3204
+ "schema": "",
3205
+ "columns": {
3206
+ "id": {
3207
+ "name": "id",
3208
+ "type": "text",
3209
+ "primaryKey": true,
3210
+ "notNull": true
3211
+ },
3212
+ "workspace_id": {
3213
+ "name": "workspace_id",
3214
+ "type": "text",
3215
+ "primaryKey": false,
3216
+ "notNull": true
3217
+ },
3218
+ "period_start": {
3219
+ "name": "period_start",
3220
+ "type": "timestamp",
3221
+ "primaryKey": false,
3222
+ "notNull": true
3223
+ },
3224
+ "period_end": {
3225
+ "name": "period_end",
3226
+ "type": "timestamp",
3227
+ "primaryKey": false,
3228
+ "notNull": true
3229
+ },
3230
+ "tokens_used": {
3231
+ "name": "tokens_used",
3232
+ "type": "integer",
3233
+ "primaryKey": false,
3234
+ "notNull": true,
3235
+ "default": 0
3236
+ },
3237
+ "request_count": {
3238
+ "name": "request_count",
3239
+ "type": "integer",
3240
+ "primaryKey": false,
3241
+ "notNull": true,
3242
+ "default": 0
3243
+ },
3244
+ "updated_at": {
3245
+ "name": "updated_at",
3246
+ "type": "timestamp",
3247
+ "primaryKey": false,
3248
+ "notNull": true,
3249
+ "default": "now()"
3250
+ }
3251
+ },
3252
+ "indexes": {
3253
+ "monthly_usage_workspace_id_idx": {
3254
+ "name": "monthly_usage_workspace_id_idx",
3255
+ "columns": [
3256
+ {
3257
+ "expression": "workspace_id",
3258
+ "isExpression": false,
3259
+ "asc": true,
3260
+ "nulls": "last"
3261
+ }
3262
+ ],
3263
+ "isUnique": false,
3264
+ "concurrently": false,
3265
+ "method": "btree",
3266
+ "with": {}
3267
+ }
3268
+ },
3269
+ "foreignKeys": {
3270
+ "monthly_usage_workspace_id_organization_id_fk": {
3271
+ "name": "monthly_usage_workspace_id_organization_id_fk",
3272
+ "tableFrom": "monthly_usage",
3273
+ "tableTo": "organization",
3274
+ "columnsFrom": ["workspace_id"],
3275
+ "columnsTo": ["id"],
3276
+ "onDelete": "cascade",
3277
+ "onUpdate": "no action"
3278
+ }
3279
+ },
3280
+ "compositePrimaryKeys": {},
3281
+ "uniqueConstraints": {
3282
+ "monthly_usage_workspace_period_unique": {
3283
+ "name": "monthly_usage_workspace_period_unique",
3284
+ "nullsNotDistinct": false,
3285
+ "columns": ["workspace_id", "period_start"]
3286
+ }
3287
+ },
3288
+ "policies": {},
3289
+ "checkConstraints": {},
3290
+ "isRLSEnabled": false
3291
+ },
3292
+ "public.notification_history": {
3293
+ "name": "notification_history",
3294
+ "schema": "",
3295
+ "columns": {
3296
+ "id": {
3297
+ "name": "id",
3298
+ "type": "text",
3299
+ "primaryKey": true,
3300
+ "notNull": true
3301
+ },
3302
+ "workspace_id": {
3303
+ "name": "workspace_id",
3304
+ "type": "text",
3305
+ "primaryKey": false,
3306
+ "notNull": true
3307
+ },
3308
+ "type": {
3309
+ "name": "type",
3310
+ "type": "text",
3311
+ "primaryKey": false,
3312
+ "notNull": true
3313
+ },
3314
+ "period_key": {
3315
+ "name": "period_key",
3316
+ "type": "text",
3317
+ "primaryKey": false,
3318
+ "notNull": true
3319
+ },
3320
+ "sent_at": {
3321
+ "name": "sent_at",
3322
+ "type": "timestamp",
3323
+ "primaryKey": false,
3324
+ "notNull": true,
3325
+ "default": "now()"
3326
+ },
3327
+ "channel": {
3328
+ "name": "channel",
3329
+ "type": "text",
3330
+ "primaryKey": false,
3331
+ "notNull": true,
3332
+ "default": "'console'"
3333
+ },
3334
+ "metadata": {
3335
+ "name": "metadata",
3336
+ "type": "text",
3337
+ "primaryKey": false,
3338
+ "notNull": false
3339
+ }
3340
+ },
3341
+ "indexes": {
3342
+ "notification_history_workspace_id_idx": {
3343
+ "name": "notification_history_workspace_id_idx",
3344
+ "columns": [
3345
+ {
3346
+ "expression": "workspace_id",
3347
+ "isExpression": false,
3348
+ "asc": true,
3349
+ "nulls": "last"
3350
+ }
3351
+ ],
3352
+ "isUnique": false,
3353
+ "concurrently": false,
3354
+ "method": "btree",
3355
+ "with": {}
3356
+ }
3357
+ },
3358
+ "foreignKeys": {
3359
+ "notification_history_workspace_id_organization_id_fk": {
3360
+ "name": "notification_history_workspace_id_organization_id_fk",
3361
+ "tableFrom": "notification_history",
3362
+ "tableTo": "organization",
3363
+ "columnsFrom": ["workspace_id"],
3364
+ "columnsTo": ["id"],
3365
+ "onDelete": "cascade",
3366
+ "onUpdate": "no action"
3367
+ }
3368
+ },
3369
+ "compositePrimaryKeys": {},
3370
+ "uniqueConstraints": {
3371
+ "notification_history_dedup_unique": {
3372
+ "name": "notification_history_dedup_unique",
3373
+ "nullsNotDistinct": false,
3374
+ "columns": ["workspace_id", "type", "period_key"]
3375
+ }
3376
+ },
3377
+ "policies": {},
3378
+ "checkConstraints": {},
3379
+ "isRLSEnabled": false
3380
+ },
3381
+ "public.rate_limit_entries": {
3382
+ "name": "rate_limit_entries",
3383
+ "schema": "",
3384
+ "columns": {
3385
+ "id": {
3386
+ "name": "id",
3387
+ "type": "text",
3388
+ "primaryKey": true,
3389
+ "notNull": true
3390
+ },
3391
+ "workspace_id": {
3392
+ "name": "workspace_id",
3393
+ "type": "text",
3394
+ "primaryKey": false,
3395
+ "notNull": true
3396
+ },
3397
+ "endpoint": {
3398
+ "name": "endpoint",
3399
+ "type": "text",
3400
+ "primaryKey": false,
3401
+ "notNull": true,
3402
+ "default": "'chat'"
3403
+ },
3404
+ "requested_at": {
3405
+ "name": "requested_at",
3406
+ "type": "timestamp",
3407
+ "primaryKey": false,
3408
+ "notNull": true,
3409
+ "default": "now()"
3410
+ }
3411
+ },
3412
+ "indexes": {
3413
+ "rate_limit_entries_window_idx": {
3414
+ "name": "rate_limit_entries_window_idx",
3415
+ "columns": [
3416
+ {
3417
+ "expression": "workspace_id",
3418
+ "isExpression": false,
3419
+ "asc": true,
3420
+ "nulls": "last"
3421
+ },
3422
+ {
3423
+ "expression": "endpoint",
3424
+ "isExpression": false,
3425
+ "asc": true,
3426
+ "nulls": "last"
3427
+ },
3428
+ {
3429
+ "expression": "requested_at",
3430
+ "isExpression": false,
3431
+ "asc": true,
3432
+ "nulls": "last"
3433
+ }
3434
+ ],
3435
+ "isUnique": false,
3436
+ "concurrently": false,
3437
+ "method": "btree",
3438
+ "with": {}
3439
+ }
3440
+ },
3441
+ "foreignKeys": {
3442
+ "rate_limit_entries_workspace_id_organization_id_fk": {
3443
+ "name": "rate_limit_entries_workspace_id_organization_id_fk",
3444
+ "tableFrom": "rate_limit_entries",
3445
+ "tableTo": "organization",
3446
+ "columnsFrom": ["workspace_id"],
3447
+ "columnsTo": ["id"],
3448
+ "onDelete": "cascade",
3449
+ "onUpdate": "no action"
3450
+ }
3451
+ },
3452
+ "compositePrimaryKeys": {},
3453
+ "uniqueConstraints": {},
3454
+ "policies": {},
3455
+ "checkConstraints": {},
3456
+ "isRLSEnabled": false
3457
+ },
3458
+ "public.trial_credits": {
3459
+ "name": "trial_credits",
3460
+ "schema": "",
3461
+ "columns": {
3462
+ "id": {
3463
+ "name": "id",
3464
+ "type": "text",
3465
+ "primaryKey": true,
3466
+ "notNull": true
3467
+ },
3468
+ "workspace_id": {
3469
+ "name": "workspace_id",
3470
+ "type": "text",
3471
+ "primaryKey": false,
3472
+ "notNull": true
3473
+ },
3474
+ "initial_credits": {
3475
+ "name": "initial_credits",
3476
+ "type": "integer",
3477
+ "primaryKey": false,
3478
+ "notNull": true,
3479
+ "default": 100000
3480
+ },
3481
+ "credits_used": {
3482
+ "name": "credits_used",
3483
+ "type": "integer",
3484
+ "primaryKey": false,
3485
+ "notNull": true,
3486
+ "default": 0
3487
+ },
3488
+ "credits_remaining": {
3489
+ "name": "credits_remaining",
3490
+ "type": "integer",
3491
+ "primaryKey": false,
3492
+ "notNull": true,
3493
+ "default": 100000
3494
+ },
3495
+ "status": {
3496
+ "name": "status",
3497
+ "type": "text",
3498
+ "primaryKey": false,
3499
+ "notNull": true,
3500
+ "default": "'active'"
3501
+ },
3502
+ "provisioned_at": {
3503
+ "name": "provisioned_at",
3504
+ "type": "timestamp",
3505
+ "primaryKey": false,
3506
+ "notNull": true,
3507
+ "default": "now()"
3508
+ },
3509
+ "trial_end_date": {
3510
+ "name": "trial_end_date",
3511
+ "type": "timestamp",
3512
+ "primaryKey": false,
3513
+ "notNull": false
3514
+ },
3515
+ "depleted_at": {
3516
+ "name": "depleted_at",
3517
+ "type": "timestamp",
3518
+ "primaryKey": false,
3519
+ "notNull": false
3520
+ },
3521
+ "converted_at": {
3522
+ "name": "converted_at",
3523
+ "type": "timestamp",
3524
+ "primaryKey": false,
3525
+ "notNull": false
3526
+ },
3527
+ "created_by_ip": {
3528
+ "name": "created_by_ip",
3529
+ "type": "text",
3530
+ "primaryKey": false,
3531
+ "notNull": false
3532
+ },
3533
+ "created_by_email": {
3534
+ "name": "created_by_email",
3535
+ "type": "text",
3536
+ "primaryKey": false,
3537
+ "notNull": false
3538
+ }
3539
+ },
3540
+ "indexes": {
3541
+ "trial_credits_expiry_idx": {
3542
+ "name": "trial_credits_expiry_idx",
3543
+ "columns": [
3544
+ {
3545
+ "expression": "status",
3546
+ "isExpression": false,
3547
+ "asc": true,
3548
+ "nulls": "last"
3549
+ },
3550
+ {
3551
+ "expression": "trial_end_date",
3552
+ "isExpression": false,
3553
+ "asc": true,
3554
+ "nulls": "last"
3555
+ }
3556
+ ],
3557
+ "isUnique": false,
3558
+ "concurrently": false,
3559
+ "method": "btree",
3560
+ "with": {}
3561
+ }
3562
+ },
3563
+ "foreignKeys": {
3564
+ "trial_credits_workspace_id_organization_id_fk": {
3565
+ "name": "trial_credits_workspace_id_organization_id_fk",
3566
+ "tableFrom": "trial_credits",
3567
+ "tableTo": "organization",
3568
+ "columnsFrom": ["workspace_id"],
3569
+ "columnsTo": ["id"],
3570
+ "onDelete": "cascade",
3571
+ "onUpdate": "no action"
3572
+ }
3573
+ },
3574
+ "compositePrimaryKeys": {},
3575
+ "uniqueConstraints": {
3576
+ "trial_credits_workspace_id_unique": {
3577
+ "name": "trial_credits_workspace_id_unique",
3578
+ "nullsNotDistinct": false,
3579
+ "columns": ["workspace_id"]
3580
+ }
3581
+ },
3582
+ "policies": {},
3583
+ "checkConstraints": {},
3584
+ "isRLSEnabled": false
3585
+ },
3586
+ "public.usage_records": {
3587
+ "name": "usage_records",
3588
+ "schema": "",
3589
+ "columns": {
3590
+ "id": {
3591
+ "name": "id",
3592
+ "type": "text",
3593
+ "primaryKey": true,
3594
+ "notNull": true
3595
+ },
3596
+ "workspace_id": {
3597
+ "name": "workspace_id",
3598
+ "type": "text",
3599
+ "primaryKey": false,
3600
+ "notNull": true
3601
+ },
3602
+ "user_id": {
3603
+ "name": "user_id",
3604
+ "type": "text",
3605
+ "primaryKey": false,
3606
+ "notNull": true
3607
+ },
3608
+ "type": {
3609
+ "name": "type",
3610
+ "type": "text",
3611
+ "primaryKey": false,
3612
+ "notNull": true
3613
+ },
3614
+ "model": {
3615
+ "name": "model",
3616
+ "type": "text",
3617
+ "primaryKey": false,
3618
+ "notNull": false
3619
+ },
3620
+ "agent": {
3621
+ "name": "agent",
3622
+ "type": "text",
3623
+ "primaryKey": false,
3624
+ "notNull": false
3625
+ },
3626
+ "input_tokens": {
3627
+ "name": "input_tokens",
3628
+ "type": "integer",
3629
+ "primaryKey": false,
3630
+ "notNull": true,
3631
+ "default": 0
3632
+ },
3633
+ "output_tokens": {
3634
+ "name": "output_tokens",
3635
+ "type": "integer",
3636
+ "primaryKey": false,
3637
+ "notNull": true,
3638
+ "default": 0
3639
+ },
3640
+ "total_tokens": {
3641
+ "name": "total_tokens",
3642
+ "type": "integer",
3643
+ "primaryKey": false,
3644
+ "notNull": true,
3645
+ "default": 0
3646
+ },
3647
+ "cost": {
3648
+ "name": "cost",
3649
+ "type": "real",
3650
+ "primaryKey": false,
3651
+ "notNull": true,
3652
+ "default": 0
3653
+ },
3654
+ "metadata": {
3655
+ "name": "metadata",
3656
+ "type": "text",
3657
+ "primaryKey": false,
3658
+ "notNull": false
3659
+ },
3660
+ "recorded_at": {
3661
+ "name": "recorded_at",
3662
+ "type": "timestamp",
3663
+ "primaryKey": false,
3664
+ "notNull": true,
3665
+ "default": "now()"
3666
+ }
3667
+ },
3668
+ "indexes": {
3669
+ "usage_records_workspace_id_idx": {
3670
+ "name": "usage_records_workspace_id_idx",
3671
+ "columns": [
3672
+ {
3673
+ "expression": "workspace_id",
3674
+ "isExpression": false,
3675
+ "asc": true,
3676
+ "nulls": "last"
3677
+ }
3678
+ ],
3679
+ "isUnique": false,
3680
+ "concurrently": false,
3681
+ "method": "btree",
3682
+ "with": {}
3683
+ },
3684
+ "usage_records_workspace_recorded_at_idx": {
3685
+ "name": "usage_records_workspace_recorded_at_idx",
3686
+ "columns": [
3687
+ {
3688
+ "expression": "workspace_id",
3689
+ "isExpression": false,
3690
+ "asc": true,
3691
+ "nulls": "last"
3692
+ },
3693
+ {
3694
+ "expression": "recorded_at",
3695
+ "isExpression": false,
3696
+ "asc": true,
3697
+ "nulls": "last"
3698
+ }
3699
+ ],
3700
+ "isUnique": false,
3701
+ "concurrently": false,
3702
+ "method": "btree",
3703
+ "with": {}
3704
+ },
3705
+ "usage_records_workspace_type_idx": {
3706
+ "name": "usage_records_workspace_type_idx",
3707
+ "columns": [
3708
+ {
3709
+ "expression": "workspace_id",
3710
+ "isExpression": false,
3711
+ "asc": true,
3712
+ "nulls": "last"
3713
+ },
3714
+ {
3715
+ "expression": "type",
3716
+ "isExpression": false,
3717
+ "asc": true,
3718
+ "nulls": "last"
3719
+ }
3720
+ ],
3721
+ "isUnique": false,
3722
+ "concurrently": false,
3723
+ "method": "btree",
3724
+ "with": {}
3725
+ }
3726
+ },
3727
+ "foreignKeys": {
3728
+ "usage_records_workspace_id_organization_id_fk": {
3729
+ "name": "usage_records_workspace_id_organization_id_fk",
3730
+ "tableFrom": "usage_records",
3731
+ "tableTo": "organization",
3732
+ "columnsFrom": ["workspace_id"],
3733
+ "columnsTo": ["id"],
3734
+ "onDelete": "cascade",
3735
+ "onUpdate": "no action"
3736
+ },
3737
+ "usage_records_user_id_users_id_fk": {
3738
+ "name": "usage_records_user_id_users_id_fk",
3739
+ "tableFrom": "usage_records",
3740
+ "tableTo": "users",
3741
+ "columnsFrom": ["user_id"],
3742
+ "columnsTo": ["id"],
3743
+ "onDelete": "cascade",
3744
+ "onUpdate": "no action"
3745
+ }
3746
+ },
3747
+ "compositePrimaryKeys": {},
3748
+ "uniqueConstraints": {},
3749
+ "policies": {},
3750
+ "checkConstraints": {},
3751
+ "isRLSEnabled": false
3752
+ },
3753
+ "public.notifications": {
3754
+ "name": "notifications",
3755
+ "schema": "",
3756
+ "columns": {
3757
+ "id": {
3758
+ "name": "id",
3759
+ "type": "text",
3760
+ "primaryKey": true,
3761
+ "notNull": true
3762
+ },
3763
+ "user_id": {
3764
+ "name": "user_id",
3765
+ "type": "text",
3766
+ "primaryKey": false,
3767
+ "notNull": true
3768
+ },
3769
+ "workspace_id": {
3770
+ "name": "workspace_id",
3771
+ "type": "text",
3772
+ "primaryKey": false,
3773
+ "notNull": false
3774
+ },
3775
+ "type": {
3776
+ "name": "type",
3777
+ "type": "text",
3778
+ "primaryKey": false,
3779
+ "notNull": true
3780
+ },
3781
+ "title": {
3782
+ "name": "title",
3783
+ "type": "text",
3784
+ "primaryKey": false,
3785
+ "notNull": true
3786
+ },
3787
+ "message": {
3788
+ "name": "message",
3789
+ "type": "text",
3790
+ "primaryKey": false,
3791
+ "notNull": true
3792
+ },
3793
+ "is_read": {
3794
+ "name": "is_read",
3795
+ "type": "boolean",
3796
+ "primaryKey": false,
3797
+ "notNull": true,
3798
+ "default": false
3799
+ },
3800
+ "metadata": {
3801
+ "name": "metadata",
3802
+ "type": "text",
3803
+ "primaryKey": false,
3804
+ "notNull": false
3805
+ },
3806
+ "created_at": {
3807
+ "name": "created_at",
3808
+ "type": "timestamp",
3809
+ "primaryKey": false,
3810
+ "notNull": true,
3811
+ "default": "now()"
3812
+ }
3813
+ },
3814
+ "indexes": {
3815
+ "notifications_user_id_idx": {
3816
+ "name": "notifications_user_id_idx",
3817
+ "columns": [
3818
+ {
3819
+ "expression": "user_id",
3820
+ "isExpression": false,
3821
+ "asc": true,
3822
+ "nulls": "last"
3823
+ }
3824
+ ],
3825
+ "isUnique": false,
3826
+ "concurrently": false,
3827
+ "method": "btree",
3828
+ "with": {}
3829
+ },
3830
+ "notifications_user_id_is_read_idx": {
3831
+ "name": "notifications_user_id_is_read_idx",
3832
+ "columns": [
3833
+ {
3834
+ "expression": "user_id",
3835
+ "isExpression": false,
3836
+ "asc": true,
3837
+ "nulls": "last"
3838
+ },
3839
+ {
3840
+ "expression": "is_read",
3841
+ "isExpression": false,
3842
+ "asc": true,
3843
+ "nulls": "last"
3844
+ }
3845
+ ],
3846
+ "isUnique": false,
3847
+ "concurrently": false,
3848
+ "method": "btree",
3849
+ "with": {}
3850
+ },
3851
+ "notifications_created_at_idx": {
3852
+ "name": "notifications_created_at_idx",
3853
+ "columns": [
3854
+ {
3855
+ "expression": "created_at",
3856
+ "isExpression": false,
3857
+ "asc": true,
3858
+ "nulls": "last"
3859
+ }
3860
+ ],
3861
+ "isUnique": false,
3862
+ "concurrently": false,
3863
+ "method": "btree",
3864
+ "with": {}
3865
+ }
3866
+ },
3867
+ "foreignKeys": {},
3868
+ "compositePrimaryKeys": {},
3869
+ "uniqueConstraints": {},
3870
+ "policies": {},
3871
+ "checkConstraints": {},
3872
+ "isRLSEnabled": false
3873
+ }
3874
+ },
3875
+ "enums": {},
3876
+ "schemas": {},
3877
+ "sequences": {},
3878
+ "roles": {},
3879
+ "policies": {},
3880
+ "views": {},
3881
+ "_meta": {
3882
+ "columns": {},
3883
+ "schemas": {},
3884
+ "tables": {}
3885
+ }
3886
+ }