@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,3770 @@
1
+ {
2
+ "id": "e5360b60-c906-4fe9-b2ea-f61c2e839a9a",
3
+ "prevId": "e5ef8184-33c4-41fc-b0ec-25d1f19af98d",
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
+ "kind": {
1995
+ "name": "kind",
1996
+ "type": "text",
1997
+ "primaryKey": false,
1998
+ "notNull": true,
1999
+ "default": "'workflow'"
2000
+ },
2001
+ "description": {
2002
+ "name": "description",
2003
+ "type": "text",
2004
+ "primaryKey": false,
2005
+ "notNull": false
2006
+ },
2007
+ "triggers": {
2008
+ "name": "triggers",
2009
+ "type": "text[]",
2010
+ "primaryKey": false,
2011
+ "notNull": true
2012
+ },
2013
+ "actions": {
2014
+ "name": "actions",
2015
+ "type": "jsonb",
2016
+ "primaryKey": false,
2017
+ "notNull": true
2018
+ },
2019
+ "enabled": {
2020
+ "name": "enabled",
2021
+ "type": "boolean",
2022
+ "primaryKey": false,
2023
+ "notNull": true,
2024
+ "default": true
2025
+ },
2026
+ "created_at": {
2027
+ "name": "created_at",
2028
+ "type": "timestamp with time zone",
2029
+ "primaryKey": false,
2030
+ "notNull": true,
2031
+ "default": "now()"
2032
+ },
2033
+ "updated_at": {
2034
+ "name": "updated_at",
2035
+ "type": "timestamp with time zone",
2036
+ "primaryKey": false,
2037
+ "notNull": true,
2038
+ "default": "now()"
2039
+ }
2040
+ },
2041
+ "indexes": {
2042
+ "automations_triggers_idx": {
2043
+ "name": "automations_triggers_idx",
2044
+ "columns": [
2045
+ {
2046
+ "expression": "triggers",
2047
+ "isExpression": false,
2048
+ "asc": true,
2049
+ "nulls": "last"
2050
+ }
2051
+ ],
2052
+ "isUnique": false,
2053
+ "concurrently": false,
2054
+ "method": "gin",
2055
+ "with": {}
2056
+ }
2057
+ },
2058
+ "foreignKeys": {
2059
+ "automations_org_id_organizations_id_fk": {
2060
+ "name": "automations_org_id_organizations_id_fk",
2061
+ "tableFrom": "automations",
2062
+ "tableTo": "organizations",
2063
+ "columnsFrom": ["org_id"],
2064
+ "columnsTo": ["id"],
2065
+ "onDelete": "no action",
2066
+ "onUpdate": "no action"
2067
+ }
2068
+ },
2069
+ "compositePrimaryKeys": {
2070
+ "automations_org_id_id_pk": {
2071
+ "name": "automations_org_id_id_pk",
2072
+ "columns": ["org_id", "id"]
2073
+ }
2074
+ },
2075
+ "uniqueConstraints": {},
2076
+ "policies": {},
2077
+ "checkConstraints": {},
2078
+ "isRLSEnabled": false
2079
+ },
2080
+ "public.settings": {
2081
+ "name": "settings",
2082
+ "schema": "",
2083
+ "columns": {
2084
+ "org_id": {
2085
+ "name": "org_id",
2086
+ "type": "text",
2087
+ "primaryKey": false,
2088
+ "notNull": true
2089
+ },
2090
+ "namespace": {
2091
+ "name": "namespace",
2092
+ "type": "text",
2093
+ "primaryKey": false,
2094
+ "notNull": true
2095
+ },
2096
+ "scope_id": {
2097
+ "name": "scope_id",
2098
+ "type": "text",
2099
+ "primaryKey": false,
2100
+ "notNull": true
2101
+ },
2102
+ "value": {
2103
+ "name": "value",
2104
+ "type": "jsonb",
2105
+ "primaryKey": false,
2106
+ "notNull": true,
2107
+ "default": "'{}'::jsonb"
2108
+ },
2109
+ "created_at": {
2110
+ "name": "created_at",
2111
+ "type": "timestamp with time zone",
2112
+ "primaryKey": false,
2113
+ "notNull": true,
2114
+ "default": "now()"
2115
+ },
2116
+ "updated_at": {
2117
+ "name": "updated_at",
2118
+ "type": "timestamp with time zone",
2119
+ "primaryKey": false,
2120
+ "notNull": true,
2121
+ "default": "now()"
2122
+ }
2123
+ },
2124
+ "indexes": {},
2125
+ "foreignKeys": {
2126
+ "settings_org_id_organizations_id_fk": {
2127
+ "name": "settings_org_id_organizations_id_fk",
2128
+ "tableFrom": "settings",
2129
+ "tableTo": "organizations",
2130
+ "columnsFrom": ["org_id"],
2131
+ "columnsTo": ["id"],
2132
+ "onDelete": "no action",
2133
+ "onUpdate": "no action"
2134
+ }
2135
+ },
2136
+ "compositePrimaryKeys": {
2137
+ "settings_org_id_namespace_scope_id_pk": {
2138
+ "name": "settings_org_id_namespace_scope_id_pk",
2139
+ "columns": ["org_id", "namespace", "scope_id"]
2140
+ }
2141
+ },
2142
+ "uniqueConstraints": {},
2143
+ "policies": {},
2144
+ "checkConstraints": {},
2145
+ "isRLSEnabled": false
2146
+ },
2147
+ "public.comment_reactions": {
2148
+ "name": "comment_reactions",
2149
+ "schema": "",
2150
+ "columns": {
2151
+ "org_id": {
2152
+ "name": "org_id",
2153
+ "type": "text",
2154
+ "primaryKey": false,
2155
+ "notNull": true
2156
+ },
2157
+ "comment_id": {
2158
+ "name": "comment_id",
2159
+ "type": "text",
2160
+ "primaryKey": false,
2161
+ "notNull": true
2162
+ },
2163
+ "org_user_id": {
2164
+ "name": "org_user_id",
2165
+ "type": "text",
2166
+ "primaryKey": false,
2167
+ "notNull": true
2168
+ },
2169
+ "emoji": {
2170
+ "name": "emoji",
2171
+ "type": "text",
2172
+ "primaryKey": false,
2173
+ "notNull": true
2174
+ },
2175
+ "created_at": {
2176
+ "name": "created_at",
2177
+ "type": "timestamp with time zone",
2178
+ "primaryKey": false,
2179
+ "notNull": true,
2180
+ "default": "now()"
2181
+ },
2182
+ "updated_at": {
2183
+ "name": "updated_at",
2184
+ "type": "timestamp with time zone",
2185
+ "primaryKey": false,
2186
+ "notNull": true,
2187
+ "default": "now()"
2188
+ }
2189
+ },
2190
+ "indexes": {},
2191
+ "foreignKeys": {
2192
+ "comment_reactions_org_id_organizations_id_fk": {
2193
+ "name": "comment_reactions_org_id_organizations_id_fk",
2194
+ "tableFrom": "comment_reactions",
2195
+ "tableTo": "organizations",
2196
+ "columnsFrom": ["org_id"],
2197
+ "columnsTo": ["id"],
2198
+ "onDelete": "no action",
2199
+ "onUpdate": "no action"
2200
+ },
2201
+ "comment_reactions_org_id_comment_id_comments_org_id_id_fk": {
2202
+ "name": "comment_reactions_org_id_comment_id_comments_org_id_id_fk",
2203
+ "tableFrom": "comment_reactions",
2204
+ "tableTo": "comments",
2205
+ "columnsFrom": ["org_id", "comment_id"],
2206
+ "columnsTo": ["org_id", "id"],
2207
+ "onDelete": "cascade",
2208
+ "onUpdate": "no action"
2209
+ },
2210
+ "comment_reactions_org_id_org_user_id_org_users_org_id_id_fk": {
2211
+ "name": "comment_reactions_org_id_org_user_id_org_users_org_id_id_fk",
2212
+ "tableFrom": "comment_reactions",
2213
+ "tableTo": "org_users",
2214
+ "columnsFrom": ["org_id", "org_user_id"],
2215
+ "columnsTo": ["org_id", "id"],
2216
+ "onDelete": "no action",
2217
+ "onUpdate": "no action"
2218
+ }
2219
+ },
2220
+ "compositePrimaryKeys": {
2221
+ "comment_reactions_org_id_comment_id_org_user_id_pk": {
2222
+ "name": "comment_reactions_org_id_comment_id_org_user_id_pk",
2223
+ "columns": ["org_id", "comment_id", "org_user_id"]
2224
+ }
2225
+ },
2226
+ "uniqueConstraints": {},
2227
+ "policies": {},
2228
+ "checkConstraints": {},
2229
+ "isRLSEnabled": false
2230
+ },
2231
+ "public.comment_reports": {
2232
+ "name": "comment_reports",
2233
+ "schema": "",
2234
+ "columns": {
2235
+ "org_id": {
2236
+ "name": "org_id",
2237
+ "type": "text",
2238
+ "primaryKey": false,
2239
+ "notNull": true
2240
+ },
2241
+ "id": {
2242
+ "name": "id",
2243
+ "type": "text",
2244
+ "primaryKey": false,
2245
+ "notNull": true
2246
+ },
2247
+ "comment_id": {
2248
+ "name": "comment_id",
2249
+ "type": "text",
2250
+ "primaryKey": false,
2251
+ "notNull": true
2252
+ },
2253
+ "org_user_id": {
2254
+ "name": "org_user_id",
2255
+ "type": "text",
2256
+ "primaryKey": false,
2257
+ "notNull": true
2258
+ },
2259
+ "reason": {
2260
+ "name": "reason",
2261
+ "type": "text",
2262
+ "primaryKey": false,
2263
+ "notNull": true,
2264
+ "default": "''"
2265
+ },
2266
+ "resolved_at": {
2267
+ "name": "resolved_at",
2268
+ "type": "timestamp with time zone",
2269
+ "primaryKey": false,
2270
+ "notNull": false
2271
+ },
2272
+ "created_at": {
2273
+ "name": "created_at",
2274
+ "type": "timestamp with time zone",
2275
+ "primaryKey": false,
2276
+ "notNull": true,
2277
+ "default": "now()"
2278
+ },
2279
+ "updated_at": {
2280
+ "name": "updated_at",
2281
+ "type": "timestamp with time zone",
2282
+ "primaryKey": false,
2283
+ "notNull": true,
2284
+ "default": "now()"
2285
+ }
2286
+ },
2287
+ "indexes": {
2288
+ "comment_reports_open_idx": {
2289
+ "name": "comment_reports_open_idx",
2290
+ "columns": [
2291
+ {
2292
+ "expression": "org_id",
2293
+ "isExpression": false,
2294
+ "asc": true,
2295
+ "nulls": "last"
2296
+ },
2297
+ {
2298
+ "expression": "comment_id",
2299
+ "isExpression": false,
2300
+ "asc": true,
2301
+ "nulls": "last"
2302
+ },
2303
+ {
2304
+ "expression": "resolved_at",
2305
+ "isExpression": false,
2306
+ "asc": true,
2307
+ "nulls": "last"
2308
+ }
2309
+ ],
2310
+ "isUnique": false,
2311
+ "concurrently": false,
2312
+ "method": "btree",
2313
+ "with": {}
2314
+ }
2315
+ },
2316
+ "foreignKeys": {
2317
+ "comment_reports_org_id_organizations_id_fk": {
2318
+ "name": "comment_reports_org_id_organizations_id_fk",
2319
+ "tableFrom": "comment_reports",
2320
+ "tableTo": "organizations",
2321
+ "columnsFrom": ["org_id"],
2322
+ "columnsTo": ["id"],
2323
+ "onDelete": "no action",
2324
+ "onUpdate": "no action"
2325
+ },
2326
+ "comment_reports_org_id_comment_id_comments_org_id_id_fk": {
2327
+ "name": "comment_reports_org_id_comment_id_comments_org_id_id_fk",
2328
+ "tableFrom": "comment_reports",
2329
+ "tableTo": "comments",
2330
+ "columnsFrom": ["org_id", "comment_id"],
2331
+ "columnsTo": ["org_id", "id"],
2332
+ "onDelete": "cascade",
2333
+ "onUpdate": "no action"
2334
+ },
2335
+ "comment_reports_org_id_org_user_id_org_users_org_id_id_fk": {
2336
+ "name": "comment_reports_org_id_org_user_id_org_users_org_id_id_fk",
2337
+ "tableFrom": "comment_reports",
2338
+ "tableTo": "org_users",
2339
+ "columnsFrom": ["org_id", "org_user_id"],
2340
+ "columnsTo": ["org_id", "id"],
2341
+ "onDelete": "no action",
2342
+ "onUpdate": "no action"
2343
+ }
2344
+ },
2345
+ "compositePrimaryKeys": {
2346
+ "comment_reports_org_id_id_pk": {
2347
+ "name": "comment_reports_org_id_id_pk",
2348
+ "columns": ["org_id", "id"]
2349
+ }
2350
+ },
2351
+ "uniqueConstraints": {
2352
+ "comment_reports_org_id_comment_id_org_user_id_unique": {
2353
+ "name": "comment_reports_org_id_comment_id_org_user_id_unique",
2354
+ "nullsNotDistinct": false,
2355
+ "columns": ["org_id", "comment_id", "org_user_id"]
2356
+ }
2357
+ },
2358
+ "policies": {},
2359
+ "checkConstraints": {},
2360
+ "isRLSEnabled": false
2361
+ },
2362
+ "public.comments": {
2363
+ "name": "comments",
2364
+ "schema": "",
2365
+ "columns": {
2366
+ "org_id": {
2367
+ "name": "org_id",
2368
+ "type": "text",
2369
+ "primaryKey": false,
2370
+ "notNull": true
2371
+ },
2372
+ "id": {
2373
+ "name": "id",
2374
+ "type": "text",
2375
+ "primaryKey": false,
2376
+ "notNull": true
2377
+ },
2378
+ "activity_id": {
2379
+ "name": "activity_id",
2380
+ "type": "text",
2381
+ "primaryKey": false,
2382
+ "notNull": true
2383
+ },
2384
+ "parent_id": {
2385
+ "name": "parent_id",
2386
+ "type": "text",
2387
+ "primaryKey": false,
2388
+ "notNull": false
2389
+ },
2390
+ "org_user_id": {
2391
+ "name": "org_user_id",
2392
+ "type": "text",
2393
+ "primaryKey": false,
2394
+ "notNull": true
2395
+ },
2396
+ "body": {
2397
+ "name": "body",
2398
+ "type": "text",
2399
+ "primaryKey": false,
2400
+ "notNull": true
2401
+ },
2402
+ "status": {
2403
+ "name": "status",
2404
+ "type": "text",
2405
+ "primaryKey": false,
2406
+ "notNull": true,
2407
+ "default": "'published'"
2408
+ },
2409
+ "removed_by": {
2410
+ "name": "removed_by",
2411
+ "type": "text",
2412
+ "primaryKey": false,
2413
+ "notNull": false
2414
+ },
2415
+ "created_at": {
2416
+ "name": "created_at",
2417
+ "type": "timestamp with time zone",
2418
+ "primaryKey": false,
2419
+ "notNull": true,
2420
+ "default": "now()"
2421
+ },
2422
+ "updated_at": {
2423
+ "name": "updated_at",
2424
+ "type": "timestamp with time zone",
2425
+ "primaryKey": false,
2426
+ "notNull": true,
2427
+ "default": "now()"
2428
+ }
2429
+ },
2430
+ "indexes": {
2431
+ "comments_activity_idx": {
2432
+ "name": "comments_activity_idx",
2433
+ "columns": [
2434
+ {
2435
+ "expression": "org_id",
2436
+ "isExpression": false,
2437
+ "asc": true,
2438
+ "nulls": "last"
2439
+ },
2440
+ {
2441
+ "expression": "activity_id",
2442
+ "isExpression": false,
2443
+ "asc": true,
2444
+ "nulls": "last"
2445
+ },
2446
+ {
2447
+ "expression": "status",
2448
+ "isExpression": false,
2449
+ "asc": true,
2450
+ "nulls": "last"
2451
+ },
2452
+ {
2453
+ "expression": "created_at",
2454
+ "isExpression": false,
2455
+ "asc": true,
2456
+ "nulls": "last"
2457
+ }
2458
+ ],
2459
+ "isUnique": false,
2460
+ "concurrently": false,
2461
+ "method": "btree",
2462
+ "with": {}
2463
+ },
2464
+ "comments_queue_idx": {
2465
+ "name": "comments_queue_idx",
2466
+ "columns": [
2467
+ {
2468
+ "expression": "org_id",
2469
+ "isExpression": false,
2470
+ "asc": true,
2471
+ "nulls": "last"
2472
+ },
2473
+ {
2474
+ "expression": "status",
2475
+ "isExpression": false,
2476
+ "asc": true,
2477
+ "nulls": "last"
2478
+ },
2479
+ {
2480
+ "expression": "created_at",
2481
+ "isExpression": false,
2482
+ "asc": true,
2483
+ "nulls": "last"
2484
+ }
2485
+ ],
2486
+ "isUnique": false,
2487
+ "concurrently": false,
2488
+ "method": "btree",
2489
+ "with": {}
2490
+ }
2491
+ },
2492
+ "foreignKeys": {
2493
+ "comments_org_id_organizations_id_fk": {
2494
+ "name": "comments_org_id_organizations_id_fk",
2495
+ "tableFrom": "comments",
2496
+ "tableTo": "organizations",
2497
+ "columnsFrom": ["org_id"],
2498
+ "columnsTo": ["id"],
2499
+ "onDelete": "no action",
2500
+ "onUpdate": "no action"
2501
+ },
2502
+ "comments_org_id_activity_id_activities_org_id_id_fk": {
2503
+ "name": "comments_org_id_activity_id_activities_org_id_id_fk",
2504
+ "tableFrom": "comments",
2505
+ "tableTo": "activities",
2506
+ "columnsFrom": ["org_id", "activity_id"],
2507
+ "columnsTo": ["org_id", "id"],
2508
+ "onDelete": "cascade",
2509
+ "onUpdate": "no action"
2510
+ },
2511
+ "comments_org_id_org_user_id_org_users_org_id_id_fk": {
2512
+ "name": "comments_org_id_org_user_id_org_users_org_id_id_fk",
2513
+ "tableFrom": "comments",
2514
+ "tableTo": "org_users",
2515
+ "columnsFrom": ["org_id", "org_user_id"],
2516
+ "columnsTo": ["org_id", "id"],
2517
+ "onDelete": "no action",
2518
+ "onUpdate": "no action"
2519
+ },
2520
+ "comments_org_id_removed_by_org_users_org_id_id_fk": {
2521
+ "name": "comments_org_id_removed_by_org_users_org_id_id_fk",
2522
+ "tableFrom": "comments",
2523
+ "tableTo": "org_users",
2524
+ "columnsFrom": ["org_id", "removed_by"],
2525
+ "columnsTo": ["org_id", "id"],
2526
+ "onDelete": "no action",
2527
+ "onUpdate": "no action"
2528
+ },
2529
+ "comments_org_id_parent_id_comments_org_id_id_fk": {
2530
+ "name": "comments_org_id_parent_id_comments_org_id_id_fk",
2531
+ "tableFrom": "comments",
2532
+ "tableTo": "comments",
2533
+ "columnsFrom": ["org_id", "parent_id"],
2534
+ "columnsTo": ["org_id", "id"],
2535
+ "onDelete": "no action",
2536
+ "onUpdate": "no action"
2537
+ }
2538
+ },
2539
+ "compositePrimaryKeys": {
2540
+ "comments_org_id_id_pk": {
2541
+ "name": "comments_org_id_id_pk",
2542
+ "columns": ["org_id", "id"]
2543
+ }
2544
+ },
2545
+ "uniqueConstraints": {},
2546
+ "policies": {},
2547
+ "checkConstraints": {
2548
+ "comments_removed_by_check": {
2549
+ "name": "comments_removed_by_check",
2550
+ "value": "(\"comments\".\"status\" = 'removed') = (\"comments\".\"removed_by\" is not null)"
2551
+ }
2552
+ },
2553
+ "isRLSEnabled": false
2554
+ },
2555
+ "public.ba_account": {
2556
+ "name": "ba_account",
2557
+ "schema": "",
2558
+ "columns": {
2559
+ "id": {
2560
+ "name": "id",
2561
+ "type": "text",
2562
+ "primaryKey": true,
2563
+ "notNull": true
2564
+ },
2565
+ "account_id": {
2566
+ "name": "account_id",
2567
+ "type": "text",
2568
+ "primaryKey": false,
2569
+ "notNull": true
2570
+ },
2571
+ "provider_id": {
2572
+ "name": "provider_id",
2573
+ "type": "text",
2574
+ "primaryKey": false,
2575
+ "notNull": true
2576
+ },
2577
+ "user_id": {
2578
+ "name": "user_id",
2579
+ "type": "text",
2580
+ "primaryKey": false,
2581
+ "notNull": true
2582
+ },
2583
+ "access_token": {
2584
+ "name": "access_token",
2585
+ "type": "text",
2586
+ "primaryKey": false,
2587
+ "notNull": false
2588
+ },
2589
+ "refresh_token": {
2590
+ "name": "refresh_token",
2591
+ "type": "text",
2592
+ "primaryKey": false,
2593
+ "notNull": false
2594
+ },
2595
+ "id_token": {
2596
+ "name": "id_token",
2597
+ "type": "text",
2598
+ "primaryKey": false,
2599
+ "notNull": false
2600
+ },
2601
+ "access_token_expires_at": {
2602
+ "name": "access_token_expires_at",
2603
+ "type": "timestamp with time zone",
2604
+ "primaryKey": false,
2605
+ "notNull": false
2606
+ },
2607
+ "refresh_token_expires_at": {
2608
+ "name": "refresh_token_expires_at",
2609
+ "type": "timestamp with time zone",
2610
+ "primaryKey": false,
2611
+ "notNull": false
2612
+ },
2613
+ "scope": {
2614
+ "name": "scope",
2615
+ "type": "text",
2616
+ "primaryKey": false,
2617
+ "notNull": false
2618
+ },
2619
+ "password": {
2620
+ "name": "password",
2621
+ "type": "text",
2622
+ "primaryKey": false,
2623
+ "notNull": false
2624
+ },
2625
+ "created_at": {
2626
+ "name": "created_at",
2627
+ "type": "timestamp with time zone",
2628
+ "primaryKey": false,
2629
+ "notNull": true
2630
+ },
2631
+ "updated_at": {
2632
+ "name": "updated_at",
2633
+ "type": "timestamp with time zone",
2634
+ "primaryKey": false,
2635
+ "notNull": true
2636
+ }
2637
+ },
2638
+ "indexes": {},
2639
+ "foreignKeys": {
2640
+ "ba_account_user_id_ba_user_id_fk": {
2641
+ "name": "ba_account_user_id_ba_user_id_fk",
2642
+ "tableFrom": "ba_account",
2643
+ "tableTo": "ba_user",
2644
+ "columnsFrom": ["user_id"],
2645
+ "columnsTo": ["id"],
2646
+ "onDelete": "cascade",
2647
+ "onUpdate": "no action"
2648
+ }
2649
+ },
2650
+ "compositePrimaryKeys": {},
2651
+ "uniqueConstraints": {},
2652
+ "policies": {},
2653
+ "checkConstraints": {},
2654
+ "isRLSEnabled": false
2655
+ },
2656
+ "public.ba_invitation": {
2657
+ "name": "ba_invitation",
2658
+ "schema": "",
2659
+ "columns": {
2660
+ "id": {
2661
+ "name": "id",
2662
+ "type": "text",
2663
+ "primaryKey": true,
2664
+ "notNull": true
2665
+ },
2666
+ "organization_id": {
2667
+ "name": "organization_id",
2668
+ "type": "text",
2669
+ "primaryKey": false,
2670
+ "notNull": true
2671
+ },
2672
+ "email": {
2673
+ "name": "email",
2674
+ "type": "text",
2675
+ "primaryKey": false,
2676
+ "notNull": true
2677
+ },
2678
+ "role": {
2679
+ "name": "role",
2680
+ "type": "text",
2681
+ "primaryKey": false,
2682
+ "notNull": true
2683
+ },
2684
+ "status": {
2685
+ "name": "status",
2686
+ "type": "text",
2687
+ "primaryKey": false,
2688
+ "notNull": true,
2689
+ "default": "'pending'"
2690
+ },
2691
+ "expires_at": {
2692
+ "name": "expires_at",
2693
+ "type": "timestamp with time zone",
2694
+ "primaryKey": false,
2695
+ "notNull": false
2696
+ },
2697
+ "inviter_id": {
2698
+ "name": "inviter_id",
2699
+ "type": "text",
2700
+ "primaryKey": false,
2701
+ "notNull": true
2702
+ },
2703
+ "created_at": {
2704
+ "name": "created_at",
2705
+ "type": "timestamp with time zone",
2706
+ "primaryKey": false,
2707
+ "notNull": true
2708
+ }
2709
+ },
2710
+ "indexes": {},
2711
+ "foreignKeys": {
2712
+ "ba_invitation_organization_id_ba_organization_id_fk": {
2713
+ "name": "ba_invitation_organization_id_ba_organization_id_fk",
2714
+ "tableFrom": "ba_invitation",
2715
+ "tableTo": "ba_organization",
2716
+ "columnsFrom": ["organization_id"],
2717
+ "columnsTo": ["id"],
2718
+ "onDelete": "cascade",
2719
+ "onUpdate": "no action"
2720
+ },
2721
+ "ba_invitation_inviter_id_ba_user_id_fk": {
2722
+ "name": "ba_invitation_inviter_id_ba_user_id_fk",
2723
+ "tableFrom": "ba_invitation",
2724
+ "tableTo": "ba_user",
2725
+ "columnsFrom": ["inviter_id"],
2726
+ "columnsTo": ["id"],
2727
+ "onDelete": "cascade",
2728
+ "onUpdate": "no action"
2729
+ }
2730
+ },
2731
+ "compositePrimaryKeys": {},
2732
+ "uniqueConstraints": {},
2733
+ "policies": {},
2734
+ "checkConstraints": {},
2735
+ "isRLSEnabled": false
2736
+ },
2737
+ "public.ba_jwks": {
2738
+ "name": "ba_jwks",
2739
+ "schema": "",
2740
+ "columns": {
2741
+ "id": {
2742
+ "name": "id",
2743
+ "type": "text",
2744
+ "primaryKey": true,
2745
+ "notNull": true
2746
+ },
2747
+ "public_key": {
2748
+ "name": "public_key",
2749
+ "type": "text",
2750
+ "primaryKey": false,
2751
+ "notNull": true
2752
+ },
2753
+ "private_key": {
2754
+ "name": "private_key",
2755
+ "type": "text",
2756
+ "primaryKey": false,
2757
+ "notNull": true
2758
+ },
2759
+ "created_at": {
2760
+ "name": "created_at",
2761
+ "type": "timestamp with time zone",
2762
+ "primaryKey": false,
2763
+ "notNull": true
2764
+ }
2765
+ },
2766
+ "indexes": {},
2767
+ "foreignKeys": {},
2768
+ "compositePrimaryKeys": {},
2769
+ "uniqueConstraints": {},
2770
+ "policies": {},
2771
+ "checkConstraints": {},
2772
+ "isRLSEnabled": false
2773
+ },
2774
+ "public.ba_member": {
2775
+ "name": "ba_member",
2776
+ "schema": "",
2777
+ "columns": {
2778
+ "id": {
2779
+ "name": "id",
2780
+ "type": "text",
2781
+ "primaryKey": true,
2782
+ "notNull": true
2783
+ },
2784
+ "organization_id": {
2785
+ "name": "organization_id",
2786
+ "type": "text",
2787
+ "primaryKey": false,
2788
+ "notNull": true
2789
+ },
2790
+ "user_id": {
2791
+ "name": "user_id",
2792
+ "type": "text",
2793
+ "primaryKey": false,
2794
+ "notNull": true
2795
+ },
2796
+ "role": {
2797
+ "name": "role",
2798
+ "type": "text",
2799
+ "primaryKey": false,
2800
+ "notNull": true,
2801
+ "default": "'member'"
2802
+ },
2803
+ "created_at": {
2804
+ "name": "created_at",
2805
+ "type": "timestamp with time zone",
2806
+ "primaryKey": false,
2807
+ "notNull": true
2808
+ }
2809
+ },
2810
+ "indexes": {},
2811
+ "foreignKeys": {
2812
+ "ba_member_organization_id_ba_organization_id_fk": {
2813
+ "name": "ba_member_organization_id_ba_organization_id_fk",
2814
+ "tableFrom": "ba_member",
2815
+ "tableTo": "ba_organization",
2816
+ "columnsFrom": ["organization_id"],
2817
+ "columnsTo": ["id"],
2818
+ "onDelete": "cascade",
2819
+ "onUpdate": "no action"
2820
+ },
2821
+ "ba_member_user_id_ba_user_id_fk": {
2822
+ "name": "ba_member_user_id_ba_user_id_fk",
2823
+ "tableFrom": "ba_member",
2824
+ "tableTo": "ba_user",
2825
+ "columnsFrom": ["user_id"],
2826
+ "columnsTo": ["id"],
2827
+ "onDelete": "cascade",
2828
+ "onUpdate": "no action"
2829
+ }
2830
+ },
2831
+ "compositePrimaryKeys": {},
2832
+ "uniqueConstraints": {},
2833
+ "policies": {},
2834
+ "checkConstraints": {},
2835
+ "isRLSEnabled": false
2836
+ },
2837
+ "public.ba_oauth_access_token": {
2838
+ "name": "ba_oauth_access_token",
2839
+ "schema": "",
2840
+ "columns": {
2841
+ "id": {
2842
+ "name": "id",
2843
+ "type": "text",
2844
+ "primaryKey": true,
2845
+ "notNull": true
2846
+ },
2847
+ "token": {
2848
+ "name": "token",
2849
+ "type": "text",
2850
+ "primaryKey": false,
2851
+ "notNull": true
2852
+ },
2853
+ "client_id": {
2854
+ "name": "client_id",
2855
+ "type": "text",
2856
+ "primaryKey": false,
2857
+ "notNull": true
2858
+ },
2859
+ "session_id": {
2860
+ "name": "session_id",
2861
+ "type": "text",
2862
+ "primaryKey": false,
2863
+ "notNull": false
2864
+ },
2865
+ "user_id": {
2866
+ "name": "user_id",
2867
+ "type": "text",
2868
+ "primaryKey": false,
2869
+ "notNull": false
2870
+ },
2871
+ "reference_id": {
2872
+ "name": "reference_id",
2873
+ "type": "text",
2874
+ "primaryKey": false,
2875
+ "notNull": false
2876
+ },
2877
+ "refresh_id": {
2878
+ "name": "refresh_id",
2879
+ "type": "text",
2880
+ "primaryKey": false,
2881
+ "notNull": false
2882
+ },
2883
+ "expires_at": {
2884
+ "name": "expires_at",
2885
+ "type": "timestamp with time zone",
2886
+ "primaryKey": false,
2887
+ "notNull": true
2888
+ },
2889
+ "created_at": {
2890
+ "name": "created_at",
2891
+ "type": "timestamp with time zone",
2892
+ "primaryKey": false,
2893
+ "notNull": true
2894
+ },
2895
+ "scopes": {
2896
+ "name": "scopes",
2897
+ "type": "text[]",
2898
+ "primaryKey": false,
2899
+ "notNull": true
2900
+ }
2901
+ },
2902
+ "indexes": {
2903
+ "ba_oauth_access_token_client_id_idx": {
2904
+ "name": "ba_oauth_access_token_client_id_idx",
2905
+ "columns": [
2906
+ {
2907
+ "expression": "client_id",
2908
+ "isExpression": false,
2909
+ "asc": true,
2910
+ "nulls": "last"
2911
+ }
2912
+ ],
2913
+ "isUnique": false,
2914
+ "concurrently": false,
2915
+ "method": "btree",
2916
+ "with": {}
2917
+ },
2918
+ "ba_oauth_access_token_session_id_idx": {
2919
+ "name": "ba_oauth_access_token_session_id_idx",
2920
+ "columns": [
2921
+ {
2922
+ "expression": "session_id",
2923
+ "isExpression": false,
2924
+ "asc": true,
2925
+ "nulls": "last"
2926
+ }
2927
+ ],
2928
+ "isUnique": false,
2929
+ "concurrently": false,
2930
+ "method": "btree",
2931
+ "with": {}
2932
+ },
2933
+ "ba_oauth_access_token_user_id_idx": {
2934
+ "name": "ba_oauth_access_token_user_id_idx",
2935
+ "columns": [
2936
+ {
2937
+ "expression": "user_id",
2938
+ "isExpression": false,
2939
+ "asc": true,
2940
+ "nulls": "last"
2941
+ }
2942
+ ],
2943
+ "isUnique": false,
2944
+ "concurrently": false,
2945
+ "method": "btree",
2946
+ "with": {}
2947
+ },
2948
+ "ba_oauth_access_token_refresh_id_idx": {
2949
+ "name": "ba_oauth_access_token_refresh_id_idx",
2950
+ "columns": [
2951
+ {
2952
+ "expression": "refresh_id",
2953
+ "isExpression": false,
2954
+ "asc": true,
2955
+ "nulls": "last"
2956
+ }
2957
+ ],
2958
+ "isUnique": false,
2959
+ "concurrently": false,
2960
+ "method": "btree",
2961
+ "with": {}
2962
+ }
2963
+ },
2964
+ "foreignKeys": {
2965
+ "ba_oauth_access_token_client_id_ba_oauth_client_client_id_fk": {
2966
+ "name": "ba_oauth_access_token_client_id_ba_oauth_client_client_id_fk",
2967
+ "tableFrom": "ba_oauth_access_token",
2968
+ "tableTo": "ba_oauth_client",
2969
+ "columnsFrom": ["client_id"],
2970
+ "columnsTo": ["client_id"],
2971
+ "onDelete": "no action",
2972
+ "onUpdate": "no action"
2973
+ },
2974
+ "ba_oauth_access_token_session_id_ba_session_id_fk": {
2975
+ "name": "ba_oauth_access_token_session_id_ba_session_id_fk",
2976
+ "tableFrom": "ba_oauth_access_token",
2977
+ "tableTo": "ba_session",
2978
+ "columnsFrom": ["session_id"],
2979
+ "columnsTo": ["id"],
2980
+ "onDelete": "set null",
2981
+ "onUpdate": "no action"
2982
+ },
2983
+ "ba_oauth_access_token_user_id_ba_user_id_fk": {
2984
+ "name": "ba_oauth_access_token_user_id_ba_user_id_fk",
2985
+ "tableFrom": "ba_oauth_access_token",
2986
+ "tableTo": "ba_user",
2987
+ "columnsFrom": ["user_id"],
2988
+ "columnsTo": ["id"],
2989
+ "onDelete": "cascade",
2990
+ "onUpdate": "no action"
2991
+ },
2992
+ "ba_oauth_access_token_refresh_id_ba_oauth_refresh_token_id_fk": {
2993
+ "name": "ba_oauth_access_token_refresh_id_ba_oauth_refresh_token_id_fk",
2994
+ "tableFrom": "ba_oauth_access_token",
2995
+ "tableTo": "ba_oauth_refresh_token",
2996
+ "columnsFrom": ["refresh_id"],
2997
+ "columnsTo": ["id"],
2998
+ "onDelete": "no action",
2999
+ "onUpdate": "no action"
3000
+ }
3001
+ },
3002
+ "compositePrimaryKeys": {},
3003
+ "uniqueConstraints": {
3004
+ "ba_oauth_access_token_token_unique": {
3005
+ "name": "ba_oauth_access_token_token_unique",
3006
+ "nullsNotDistinct": false,
3007
+ "columns": ["token"]
3008
+ }
3009
+ },
3010
+ "policies": {},
3011
+ "checkConstraints": {},
3012
+ "isRLSEnabled": false
3013
+ },
3014
+ "public.ba_oauth_client": {
3015
+ "name": "ba_oauth_client",
3016
+ "schema": "",
3017
+ "columns": {
3018
+ "id": {
3019
+ "name": "id",
3020
+ "type": "text",
3021
+ "primaryKey": true,
3022
+ "notNull": true
3023
+ },
3024
+ "client_id": {
3025
+ "name": "client_id",
3026
+ "type": "text",
3027
+ "primaryKey": false,
3028
+ "notNull": true
3029
+ },
3030
+ "client_secret": {
3031
+ "name": "client_secret",
3032
+ "type": "text",
3033
+ "primaryKey": false,
3034
+ "notNull": false
3035
+ },
3036
+ "disabled": {
3037
+ "name": "disabled",
3038
+ "type": "boolean",
3039
+ "primaryKey": false,
3040
+ "notNull": false,
3041
+ "default": false
3042
+ },
3043
+ "skip_consent": {
3044
+ "name": "skip_consent",
3045
+ "type": "boolean",
3046
+ "primaryKey": false,
3047
+ "notNull": false
3048
+ },
3049
+ "enable_end_session": {
3050
+ "name": "enable_end_session",
3051
+ "type": "boolean",
3052
+ "primaryKey": false,
3053
+ "notNull": false
3054
+ },
3055
+ "subject_type": {
3056
+ "name": "subject_type",
3057
+ "type": "text",
3058
+ "primaryKey": false,
3059
+ "notNull": false
3060
+ },
3061
+ "scopes": {
3062
+ "name": "scopes",
3063
+ "type": "text[]",
3064
+ "primaryKey": false,
3065
+ "notNull": false
3066
+ },
3067
+ "user_id": {
3068
+ "name": "user_id",
3069
+ "type": "text",
3070
+ "primaryKey": false,
3071
+ "notNull": false
3072
+ },
3073
+ "name": {
3074
+ "name": "name",
3075
+ "type": "text",
3076
+ "primaryKey": false,
3077
+ "notNull": false
3078
+ },
3079
+ "uri": {
3080
+ "name": "uri",
3081
+ "type": "text",
3082
+ "primaryKey": false,
3083
+ "notNull": false
3084
+ },
3085
+ "icon": {
3086
+ "name": "icon",
3087
+ "type": "text",
3088
+ "primaryKey": false,
3089
+ "notNull": false
3090
+ },
3091
+ "contacts": {
3092
+ "name": "contacts",
3093
+ "type": "text[]",
3094
+ "primaryKey": false,
3095
+ "notNull": false
3096
+ },
3097
+ "tos": {
3098
+ "name": "tos",
3099
+ "type": "text",
3100
+ "primaryKey": false,
3101
+ "notNull": false
3102
+ },
3103
+ "policy": {
3104
+ "name": "policy",
3105
+ "type": "text",
3106
+ "primaryKey": false,
3107
+ "notNull": false
3108
+ },
3109
+ "software_id": {
3110
+ "name": "software_id",
3111
+ "type": "text",
3112
+ "primaryKey": false,
3113
+ "notNull": false
3114
+ },
3115
+ "software_version": {
3116
+ "name": "software_version",
3117
+ "type": "text",
3118
+ "primaryKey": false,
3119
+ "notNull": false
3120
+ },
3121
+ "software_statement": {
3122
+ "name": "software_statement",
3123
+ "type": "text",
3124
+ "primaryKey": false,
3125
+ "notNull": false
3126
+ },
3127
+ "redirect_uris": {
3128
+ "name": "redirect_uris",
3129
+ "type": "text[]",
3130
+ "primaryKey": false,
3131
+ "notNull": true
3132
+ },
3133
+ "post_logout_redirect_uris": {
3134
+ "name": "post_logout_redirect_uris",
3135
+ "type": "text[]",
3136
+ "primaryKey": false,
3137
+ "notNull": false
3138
+ },
3139
+ "token_endpoint_auth_method": {
3140
+ "name": "token_endpoint_auth_method",
3141
+ "type": "text",
3142
+ "primaryKey": false,
3143
+ "notNull": false
3144
+ },
3145
+ "grant_types": {
3146
+ "name": "grant_types",
3147
+ "type": "text[]",
3148
+ "primaryKey": false,
3149
+ "notNull": false
3150
+ },
3151
+ "response_types": {
3152
+ "name": "response_types",
3153
+ "type": "text[]",
3154
+ "primaryKey": false,
3155
+ "notNull": false
3156
+ },
3157
+ "public": {
3158
+ "name": "public",
3159
+ "type": "boolean",
3160
+ "primaryKey": false,
3161
+ "notNull": false
3162
+ },
3163
+ "type": {
3164
+ "name": "type",
3165
+ "type": "text",
3166
+ "primaryKey": false,
3167
+ "notNull": false
3168
+ },
3169
+ "require_pkce": {
3170
+ "name": "require_pkce",
3171
+ "type": "boolean",
3172
+ "primaryKey": false,
3173
+ "notNull": false
3174
+ },
3175
+ "reference_id": {
3176
+ "name": "reference_id",
3177
+ "type": "text",
3178
+ "primaryKey": false,
3179
+ "notNull": false
3180
+ },
3181
+ "metadata": {
3182
+ "name": "metadata",
3183
+ "type": "text",
3184
+ "primaryKey": false,
3185
+ "notNull": false
3186
+ },
3187
+ "created_at": {
3188
+ "name": "created_at",
3189
+ "type": "timestamp with time zone",
3190
+ "primaryKey": false,
3191
+ "notNull": false
3192
+ },
3193
+ "updated_at": {
3194
+ "name": "updated_at",
3195
+ "type": "timestamp with time zone",
3196
+ "primaryKey": false,
3197
+ "notNull": false
3198
+ }
3199
+ },
3200
+ "indexes": {
3201
+ "ba_oauth_client_user_id_idx": {
3202
+ "name": "ba_oauth_client_user_id_idx",
3203
+ "columns": [
3204
+ {
3205
+ "expression": "user_id",
3206
+ "isExpression": false,
3207
+ "asc": true,
3208
+ "nulls": "last"
3209
+ }
3210
+ ],
3211
+ "isUnique": false,
3212
+ "concurrently": false,
3213
+ "method": "btree",
3214
+ "with": {}
3215
+ }
3216
+ },
3217
+ "foreignKeys": {
3218
+ "ba_oauth_client_user_id_ba_user_id_fk": {
3219
+ "name": "ba_oauth_client_user_id_ba_user_id_fk",
3220
+ "tableFrom": "ba_oauth_client",
3221
+ "tableTo": "ba_user",
3222
+ "columnsFrom": ["user_id"],
3223
+ "columnsTo": ["id"],
3224
+ "onDelete": "cascade",
3225
+ "onUpdate": "no action"
3226
+ }
3227
+ },
3228
+ "compositePrimaryKeys": {},
3229
+ "uniqueConstraints": {
3230
+ "ba_oauth_client_client_id_unique": {
3231
+ "name": "ba_oauth_client_client_id_unique",
3232
+ "nullsNotDistinct": false,
3233
+ "columns": ["client_id"]
3234
+ }
3235
+ },
3236
+ "policies": {},
3237
+ "checkConstraints": {},
3238
+ "isRLSEnabled": false
3239
+ },
3240
+ "public.ba_oauth_consent": {
3241
+ "name": "ba_oauth_consent",
3242
+ "schema": "",
3243
+ "columns": {
3244
+ "id": {
3245
+ "name": "id",
3246
+ "type": "text",
3247
+ "primaryKey": true,
3248
+ "notNull": true
3249
+ },
3250
+ "client_id": {
3251
+ "name": "client_id",
3252
+ "type": "text",
3253
+ "primaryKey": false,
3254
+ "notNull": true
3255
+ },
3256
+ "user_id": {
3257
+ "name": "user_id",
3258
+ "type": "text",
3259
+ "primaryKey": false,
3260
+ "notNull": false
3261
+ },
3262
+ "reference_id": {
3263
+ "name": "reference_id",
3264
+ "type": "text",
3265
+ "primaryKey": false,
3266
+ "notNull": false
3267
+ },
3268
+ "scopes": {
3269
+ "name": "scopes",
3270
+ "type": "text[]",
3271
+ "primaryKey": false,
3272
+ "notNull": true
3273
+ },
3274
+ "created_at": {
3275
+ "name": "created_at",
3276
+ "type": "timestamp with time zone",
3277
+ "primaryKey": false,
3278
+ "notNull": true
3279
+ },
3280
+ "updated_at": {
3281
+ "name": "updated_at",
3282
+ "type": "timestamp with time zone",
3283
+ "primaryKey": false,
3284
+ "notNull": true
3285
+ }
3286
+ },
3287
+ "indexes": {
3288
+ "ba_oauth_consent_client_id_idx": {
3289
+ "name": "ba_oauth_consent_client_id_idx",
3290
+ "columns": [
3291
+ {
3292
+ "expression": "client_id",
3293
+ "isExpression": false,
3294
+ "asc": true,
3295
+ "nulls": "last"
3296
+ }
3297
+ ],
3298
+ "isUnique": false,
3299
+ "concurrently": false,
3300
+ "method": "btree",
3301
+ "with": {}
3302
+ },
3303
+ "ba_oauth_consent_user_id_idx": {
3304
+ "name": "ba_oauth_consent_user_id_idx",
3305
+ "columns": [
3306
+ {
3307
+ "expression": "user_id",
3308
+ "isExpression": false,
3309
+ "asc": true,
3310
+ "nulls": "last"
3311
+ }
3312
+ ],
3313
+ "isUnique": false,
3314
+ "concurrently": false,
3315
+ "method": "btree",
3316
+ "with": {}
3317
+ }
3318
+ },
3319
+ "foreignKeys": {
3320
+ "ba_oauth_consent_client_id_ba_oauth_client_client_id_fk": {
3321
+ "name": "ba_oauth_consent_client_id_ba_oauth_client_client_id_fk",
3322
+ "tableFrom": "ba_oauth_consent",
3323
+ "tableTo": "ba_oauth_client",
3324
+ "columnsFrom": ["client_id"],
3325
+ "columnsTo": ["client_id"],
3326
+ "onDelete": "no action",
3327
+ "onUpdate": "no action"
3328
+ },
3329
+ "ba_oauth_consent_user_id_ba_user_id_fk": {
3330
+ "name": "ba_oauth_consent_user_id_ba_user_id_fk",
3331
+ "tableFrom": "ba_oauth_consent",
3332
+ "tableTo": "ba_user",
3333
+ "columnsFrom": ["user_id"],
3334
+ "columnsTo": ["id"],
3335
+ "onDelete": "cascade",
3336
+ "onUpdate": "no action"
3337
+ }
3338
+ },
3339
+ "compositePrimaryKeys": {},
3340
+ "uniqueConstraints": {},
3341
+ "policies": {},
3342
+ "checkConstraints": {},
3343
+ "isRLSEnabled": false
3344
+ },
3345
+ "public.ba_oauth_refresh_token": {
3346
+ "name": "ba_oauth_refresh_token",
3347
+ "schema": "",
3348
+ "columns": {
3349
+ "id": {
3350
+ "name": "id",
3351
+ "type": "text",
3352
+ "primaryKey": true,
3353
+ "notNull": true
3354
+ },
3355
+ "token": {
3356
+ "name": "token",
3357
+ "type": "text",
3358
+ "primaryKey": false,
3359
+ "notNull": true
3360
+ },
3361
+ "client_id": {
3362
+ "name": "client_id",
3363
+ "type": "text",
3364
+ "primaryKey": false,
3365
+ "notNull": true
3366
+ },
3367
+ "session_id": {
3368
+ "name": "session_id",
3369
+ "type": "text",
3370
+ "primaryKey": false,
3371
+ "notNull": false
3372
+ },
3373
+ "user_id": {
3374
+ "name": "user_id",
3375
+ "type": "text",
3376
+ "primaryKey": false,
3377
+ "notNull": true
3378
+ },
3379
+ "reference_id": {
3380
+ "name": "reference_id",
3381
+ "type": "text",
3382
+ "primaryKey": false,
3383
+ "notNull": false
3384
+ },
3385
+ "expires_at": {
3386
+ "name": "expires_at",
3387
+ "type": "timestamp with time zone",
3388
+ "primaryKey": false,
3389
+ "notNull": true
3390
+ },
3391
+ "created_at": {
3392
+ "name": "created_at",
3393
+ "type": "timestamp with time zone",
3394
+ "primaryKey": false,
3395
+ "notNull": true
3396
+ },
3397
+ "revoked": {
3398
+ "name": "revoked",
3399
+ "type": "timestamp with time zone",
3400
+ "primaryKey": false,
3401
+ "notNull": false
3402
+ },
3403
+ "auth_time": {
3404
+ "name": "auth_time",
3405
+ "type": "timestamp with time zone",
3406
+ "primaryKey": false,
3407
+ "notNull": false
3408
+ },
3409
+ "scopes": {
3410
+ "name": "scopes",
3411
+ "type": "text[]",
3412
+ "primaryKey": false,
3413
+ "notNull": true
3414
+ }
3415
+ },
3416
+ "indexes": {
3417
+ "ba_oauth_refresh_token_client_id_idx": {
3418
+ "name": "ba_oauth_refresh_token_client_id_idx",
3419
+ "columns": [
3420
+ {
3421
+ "expression": "client_id",
3422
+ "isExpression": false,
3423
+ "asc": true,
3424
+ "nulls": "last"
3425
+ }
3426
+ ],
3427
+ "isUnique": false,
3428
+ "concurrently": false,
3429
+ "method": "btree",
3430
+ "with": {}
3431
+ },
3432
+ "ba_oauth_refresh_token_session_id_idx": {
3433
+ "name": "ba_oauth_refresh_token_session_id_idx",
3434
+ "columns": [
3435
+ {
3436
+ "expression": "session_id",
3437
+ "isExpression": false,
3438
+ "asc": true,
3439
+ "nulls": "last"
3440
+ }
3441
+ ],
3442
+ "isUnique": false,
3443
+ "concurrently": false,
3444
+ "method": "btree",
3445
+ "with": {}
3446
+ },
3447
+ "ba_oauth_refresh_token_user_id_idx": {
3448
+ "name": "ba_oauth_refresh_token_user_id_idx",
3449
+ "columns": [
3450
+ {
3451
+ "expression": "user_id",
3452
+ "isExpression": false,
3453
+ "asc": true,
3454
+ "nulls": "last"
3455
+ }
3456
+ ],
3457
+ "isUnique": false,
3458
+ "concurrently": false,
3459
+ "method": "btree",
3460
+ "with": {}
3461
+ }
3462
+ },
3463
+ "foreignKeys": {
3464
+ "ba_oauth_refresh_token_client_id_ba_oauth_client_client_id_fk": {
3465
+ "name": "ba_oauth_refresh_token_client_id_ba_oauth_client_client_id_fk",
3466
+ "tableFrom": "ba_oauth_refresh_token",
3467
+ "tableTo": "ba_oauth_client",
3468
+ "columnsFrom": ["client_id"],
3469
+ "columnsTo": ["client_id"],
3470
+ "onDelete": "no action",
3471
+ "onUpdate": "no action"
3472
+ },
3473
+ "ba_oauth_refresh_token_session_id_ba_session_id_fk": {
3474
+ "name": "ba_oauth_refresh_token_session_id_ba_session_id_fk",
3475
+ "tableFrom": "ba_oauth_refresh_token",
3476
+ "tableTo": "ba_session",
3477
+ "columnsFrom": ["session_id"],
3478
+ "columnsTo": ["id"],
3479
+ "onDelete": "set null",
3480
+ "onUpdate": "no action"
3481
+ },
3482
+ "ba_oauth_refresh_token_user_id_ba_user_id_fk": {
3483
+ "name": "ba_oauth_refresh_token_user_id_ba_user_id_fk",
3484
+ "tableFrom": "ba_oauth_refresh_token",
3485
+ "tableTo": "ba_user",
3486
+ "columnsFrom": ["user_id"],
3487
+ "columnsTo": ["id"],
3488
+ "onDelete": "cascade",
3489
+ "onUpdate": "no action"
3490
+ }
3491
+ },
3492
+ "compositePrimaryKeys": {},
3493
+ "uniqueConstraints": {
3494
+ "ba_oauth_refresh_token_token_unique": {
3495
+ "name": "ba_oauth_refresh_token_token_unique",
3496
+ "nullsNotDistinct": false,
3497
+ "columns": ["token"]
3498
+ }
3499
+ },
3500
+ "policies": {},
3501
+ "checkConstraints": {},
3502
+ "isRLSEnabled": false
3503
+ },
3504
+ "public.ba_organization": {
3505
+ "name": "ba_organization",
3506
+ "schema": "",
3507
+ "columns": {
3508
+ "id": {
3509
+ "name": "id",
3510
+ "type": "text",
3511
+ "primaryKey": true,
3512
+ "notNull": true
3513
+ },
3514
+ "name": {
3515
+ "name": "name",
3516
+ "type": "text",
3517
+ "primaryKey": false,
3518
+ "notNull": true
3519
+ },
3520
+ "slug": {
3521
+ "name": "slug",
3522
+ "type": "text",
3523
+ "primaryKey": false,
3524
+ "notNull": true
3525
+ },
3526
+ "logo": {
3527
+ "name": "logo",
3528
+ "type": "text",
3529
+ "primaryKey": false,
3530
+ "notNull": false
3531
+ },
3532
+ "metadata": {
3533
+ "name": "metadata",
3534
+ "type": "text",
3535
+ "primaryKey": false,
3536
+ "notNull": false
3537
+ },
3538
+ "created_at": {
3539
+ "name": "created_at",
3540
+ "type": "timestamp with time zone",
3541
+ "primaryKey": false,
3542
+ "notNull": true
3543
+ },
3544
+ "updated_at": {
3545
+ "name": "updated_at",
3546
+ "type": "timestamp with time zone",
3547
+ "primaryKey": false,
3548
+ "notNull": false
3549
+ }
3550
+ },
3551
+ "indexes": {},
3552
+ "foreignKeys": {},
3553
+ "compositePrimaryKeys": {},
3554
+ "uniqueConstraints": {
3555
+ "ba_organization_slug_unique": {
3556
+ "name": "ba_organization_slug_unique",
3557
+ "nullsNotDistinct": false,
3558
+ "columns": ["slug"]
3559
+ }
3560
+ },
3561
+ "policies": {},
3562
+ "checkConstraints": {},
3563
+ "isRLSEnabled": false
3564
+ },
3565
+ "public.ba_session": {
3566
+ "name": "ba_session",
3567
+ "schema": "",
3568
+ "columns": {
3569
+ "id": {
3570
+ "name": "id",
3571
+ "type": "text",
3572
+ "primaryKey": true,
3573
+ "notNull": true
3574
+ },
3575
+ "expires_at": {
3576
+ "name": "expires_at",
3577
+ "type": "timestamp with time zone",
3578
+ "primaryKey": false,
3579
+ "notNull": true
3580
+ },
3581
+ "token": {
3582
+ "name": "token",
3583
+ "type": "text",
3584
+ "primaryKey": false,
3585
+ "notNull": true
3586
+ },
3587
+ "created_at": {
3588
+ "name": "created_at",
3589
+ "type": "timestamp with time zone",
3590
+ "primaryKey": false,
3591
+ "notNull": true
3592
+ },
3593
+ "updated_at": {
3594
+ "name": "updated_at",
3595
+ "type": "timestamp with time zone",
3596
+ "primaryKey": false,
3597
+ "notNull": true
3598
+ },
3599
+ "ip_address": {
3600
+ "name": "ip_address",
3601
+ "type": "text",
3602
+ "primaryKey": false,
3603
+ "notNull": false
3604
+ },
3605
+ "user_agent": {
3606
+ "name": "user_agent",
3607
+ "type": "text",
3608
+ "primaryKey": false,
3609
+ "notNull": false
3610
+ },
3611
+ "user_id": {
3612
+ "name": "user_id",
3613
+ "type": "text",
3614
+ "primaryKey": false,
3615
+ "notNull": true
3616
+ },
3617
+ "active_organization_id": {
3618
+ "name": "active_organization_id",
3619
+ "type": "text",
3620
+ "primaryKey": false,
3621
+ "notNull": false
3622
+ }
3623
+ },
3624
+ "indexes": {},
3625
+ "foreignKeys": {
3626
+ "ba_session_user_id_ba_user_id_fk": {
3627
+ "name": "ba_session_user_id_ba_user_id_fk",
3628
+ "tableFrom": "ba_session",
3629
+ "tableTo": "ba_user",
3630
+ "columnsFrom": ["user_id"],
3631
+ "columnsTo": ["id"],
3632
+ "onDelete": "cascade",
3633
+ "onUpdate": "no action"
3634
+ }
3635
+ },
3636
+ "compositePrimaryKeys": {},
3637
+ "uniqueConstraints": {
3638
+ "ba_session_token_unique": {
3639
+ "name": "ba_session_token_unique",
3640
+ "nullsNotDistinct": false,
3641
+ "columns": ["token"]
3642
+ }
3643
+ },
3644
+ "policies": {},
3645
+ "checkConstraints": {},
3646
+ "isRLSEnabled": false
3647
+ },
3648
+ "public.ba_user": {
3649
+ "name": "ba_user",
3650
+ "schema": "",
3651
+ "columns": {
3652
+ "id": {
3653
+ "name": "id",
3654
+ "type": "text",
3655
+ "primaryKey": true,
3656
+ "notNull": true
3657
+ },
3658
+ "name": {
3659
+ "name": "name",
3660
+ "type": "text",
3661
+ "primaryKey": false,
3662
+ "notNull": true
3663
+ },
3664
+ "email": {
3665
+ "name": "email",
3666
+ "type": "text",
3667
+ "primaryKey": false,
3668
+ "notNull": true
3669
+ },
3670
+ "email_verified": {
3671
+ "name": "email_verified",
3672
+ "type": "boolean",
3673
+ "primaryKey": false,
3674
+ "notNull": true
3675
+ },
3676
+ "image": {
3677
+ "name": "image",
3678
+ "type": "text",
3679
+ "primaryKey": false,
3680
+ "notNull": false
3681
+ },
3682
+ "created_at": {
3683
+ "name": "created_at",
3684
+ "type": "timestamp with time zone",
3685
+ "primaryKey": false,
3686
+ "notNull": true
3687
+ },
3688
+ "updated_at": {
3689
+ "name": "updated_at",
3690
+ "type": "timestamp with time zone",
3691
+ "primaryKey": false,
3692
+ "notNull": true
3693
+ }
3694
+ },
3695
+ "indexes": {},
3696
+ "foreignKeys": {},
3697
+ "compositePrimaryKeys": {},
3698
+ "uniqueConstraints": {
3699
+ "ba_user_email_unique": {
3700
+ "name": "ba_user_email_unique",
3701
+ "nullsNotDistinct": false,
3702
+ "columns": ["email"]
3703
+ }
3704
+ },
3705
+ "policies": {},
3706
+ "checkConstraints": {},
3707
+ "isRLSEnabled": false
3708
+ },
3709
+ "public.ba_verification": {
3710
+ "name": "ba_verification",
3711
+ "schema": "",
3712
+ "columns": {
3713
+ "id": {
3714
+ "name": "id",
3715
+ "type": "text",
3716
+ "primaryKey": true,
3717
+ "notNull": true
3718
+ },
3719
+ "identifier": {
3720
+ "name": "identifier",
3721
+ "type": "text",
3722
+ "primaryKey": false,
3723
+ "notNull": true
3724
+ },
3725
+ "value": {
3726
+ "name": "value",
3727
+ "type": "text",
3728
+ "primaryKey": false,
3729
+ "notNull": true
3730
+ },
3731
+ "expires_at": {
3732
+ "name": "expires_at",
3733
+ "type": "timestamp with time zone",
3734
+ "primaryKey": false,
3735
+ "notNull": true
3736
+ },
3737
+ "created_at": {
3738
+ "name": "created_at",
3739
+ "type": "timestamp with time zone",
3740
+ "primaryKey": false,
3741
+ "notNull": false
3742
+ },
3743
+ "updated_at": {
3744
+ "name": "updated_at",
3745
+ "type": "timestamp with time zone",
3746
+ "primaryKey": false,
3747
+ "notNull": false
3748
+ }
3749
+ },
3750
+ "indexes": {},
3751
+ "foreignKeys": {},
3752
+ "compositePrimaryKeys": {},
3753
+ "uniqueConstraints": {},
3754
+ "policies": {},
3755
+ "checkConstraints": {},
3756
+ "isRLSEnabled": false
3757
+ }
3758
+ },
3759
+ "enums": {},
3760
+ "schemas": {},
3761
+ "sequences": {},
3762
+ "roles": {},
3763
+ "policies": {},
3764
+ "views": {},
3765
+ "_meta": {
3766
+ "columns": {},
3767
+ "schemas": {},
3768
+ "tables": {}
3769
+ }
3770
+ }