@headless-lms/adapter-db 0.1.0 → 0.3.0

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