@headless-lms/adapter-db 0.1.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 (115) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/client.d.ts +17 -0
  4. package/dist/client.js +11 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/index.d.ts +22 -0
  7. package/dist/index.js +22 -0
  8. package/dist/migrate.d.ts +7 -0
  9. package/dist/migrate.js +27 -0
  10. package/dist/migrate.js.map +1 -0
  11. package/dist/repositories/assets.d.ts +17 -0
  12. package/dist/repositories/assets.js +90 -0
  13. package/dist/repositories/assets.js.map +1 -0
  14. package/dist/repositories/automations.d.ts +30 -0
  15. package/dist/repositories/automations.js +165 -0
  16. package/dist/repositories/automations.js.map +1 -0
  17. package/dist/repositories/content.d.ts +52 -0
  18. package/dist/repositories/content.js +350 -0
  19. package/dist/repositories/content.js.map +1 -0
  20. package/dist/repositories/credentials.d.ts +25 -0
  21. package/dist/repositories/credentials.js +86 -0
  22. package/dist/repositories/credentials.js.map +1 -0
  23. package/dist/repositories/dashboard.d.ts +14 -0
  24. package/dist/repositories/dashboard.js +55 -0
  25. package/dist/repositories/dashboard.js.map +1 -0
  26. package/dist/repositories/discussion.d.ts +31 -0
  27. package/dist/repositories/discussion.js +201 -0
  28. package/dist/repositories/discussion.js.map +1 -0
  29. package/dist/repositories/entitlements.d.ts +23 -0
  30. package/dist/repositories/entitlements.js +129 -0
  31. package/dist/repositories/entitlements.js.map +1 -0
  32. package/dist/repositories/identity.d.ts +17 -0
  33. package/dist/repositories/identity.js +44 -0
  34. package/dist/repositories/identity.js.map +1 -0
  35. package/dist/repositories/integrations.d.ts +18 -0
  36. package/dist/repositories/integrations.js +65 -0
  37. package/dist/repositories/integrations.js.map +1 -0
  38. package/dist/repositories/learn.d.ts +19 -0
  39. package/dist/repositories/learn.js +54 -0
  40. package/dist/repositories/learn.js.map +1 -0
  41. package/dist/repositories/members.d.ts +16 -0
  42. package/dist/repositories/members.js +116 -0
  43. package/dist/repositories/members.js.map +1 -0
  44. package/dist/repositories/org-user-profile.d.ts +92 -0
  45. package/dist/repositories/org-user-profile.js +16 -0
  46. package/dist/repositories/org-user-profile.js.map +1 -0
  47. package/dist/repositories/organizations.d.ts +33 -0
  48. package/dist/repositories/organizations.js +198 -0
  49. package/dist/repositories/organizations.js.map +1 -0
  50. package/dist/repositories/outbox.d.ts +24 -0
  51. package/dist/repositories/outbox.js +56 -0
  52. package/dist/repositories/outbox.js.map +1 -0
  53. package/dist/repositories/pg-errors.d.ts +11 -0
  54. package/dist/repositories/pg-errors.js +15 -0
  55. package/dist/repositories/pg-errors.js.map +1 -0
  56. package/dist/repositories/progress.d.ts +18 -0
  57. package/dist/repositories/progress.js +59 -0
  58. package/dist/repositories/progress.js.map +1 -0
  59. package/dist/repositories/settings.d.ts +22 -0
  60. package/dist/repositories/settings.js +73 -0
  61. package/dist/repositories/settings.js.map +1 -0
  62. package/dist/repositories/students.d.ts +15 -0
  63. package/dist/repositories/students.js +83 -0
  64. package/dist/repositories/students.js.map +1 -0
  65. package/dist/schema/assets.d.ts +181 -0
  66. package/dist/schema/assets.js +24 -0
  67. package/dist/schema/assets.js.map +1 -0
  68. package/dist/schema/automations.d.ts +364 -0
  69. package/dist/schema/automations.js +42 -0
  70. package/dist/schema/automations.js.map +1 -0
  71. package/dist/schema/better-auth.d.ts +2311 -0
  72. package/dist/schema/better-auth.js +156 -0
  73. package/dist/schema/better-auth.js.map +1 -0
  74. package/dist/schema/content.d.ts +966 -0
  75. package/dist/schema/content.js +163 -0
  76. package/dist/schema/content.js.map +1 -0
  77. package/dist/schema/credentials.d.ts +113 -0
  78. package/dist/schema/credentials.js +15 -0
  79. package/dist/schema/credentials.js.map +1 -0
  80. package/dist/schema/discussion.d.ts +399 -0
  81. package/dist/schema/discussion.js +89 -0
  82. package/dist/schema/discussion.js.map +1 -0
  83. package/dist/schema/drift.d.ts +9 -0
  84. package/dist/schema/drift.js +1 -0
  85. package/dist/schema/entitlements.d.ts +147 -0
  86. package/dist/schema/entitlements.js +30 -0
  87. package/dist/schema/entitlements.js.map +1 -0
  88. package/dist/schema/identity.d.ts +130 -0
  89. package/dist/schema/identity.js +16 -0
  90. package/dist/schema/identity.js.map +1 -0
  91. package/dist/schema/index.d.ts +18 -0
  92. package/dist/schema/index.js +43 -0
  93. package/dist/schema/index.js.map +1 -0
  94. package/dist/schema/integrations.d.ts +149 -0
  95. package/dist/schema/integrations.js +25 -0
  96. package/dist/schema/integrations.js.map +1 -0
  97. package/dist/schema/organizations.d.ts +416 -0
  98. package/dist/schema/organizations.js +58 -0
  99. package/dist/schema/organizations.js.map +1 -0
  100. package/dist/schema/outbox.d.ts +166 -0
  101. package/dist/schema/outbox.js +19 -0
  102. package/dist/schema/outbox.js.map +1 -0
  103. package/dist/schema/progress.d.ts +166 -0
  104. package/dist/schema/progress.js +30 -0
  105. package/dist/schema/progress.js.map +1 -0
  106. package/dist/schema/settings.d.ts +115 -0
  107. package/dist/schema/settings.js +19 -0
  108. package/dist/schema/settings.js.map +1 -0
  109. package/dist/unit-of-work.d.ts +13 -0
  110. package/dist/unit-of-work.js +16 -0
  111. package/dist/unit-of-work.js.map +1 -0
  112. package/drizzle/0000_baseline.sql +526 -0
  113. package/drizzle/meta/0000_snapshot.json +3925 -0
  114. package/drizzle/meta/_journal.json +13 -0
  115. package/package.json +56 -0
@@ -0,0 +1,526 @@
1
+ CREATE TABLE "invites" (
2
+ "org_id" text NOT NULL,
3
+ "id" text NOT NULL,
4
+ "email" text NOT NULL,
5
+ "role" text NOT NULL,
6
+ "status" text NOT NULL,
7
+ "invited_by" text NOT NULL,
8
+ "token_hash" text,
9
+ "expires_at" timestamp with time zone,
10
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ CONSTRAINT "invites_org_id_id_pk" PRIMARY KEY("org_id","id"),
12
+ CONSTRAINT "invites_token_hash_unique" UNIQUE("token_hash")
13
+ );
14
+ --> statement-breakpoint
15
+ CREATE TABLE "org_users" (
16
+ "org_id" text NOT NULL,
17
+ "id" text NOT NULL,
18
+ "user_id" text NOT NULL,
19
+ "role" text NOT NULL,
20
+ "status" text DEFAULT 'active' NOT NULL,
21
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
22
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
23
+ CONSTRAINT "org_users_org_id_id_pk" PRIMARY KEY("org_id","id"),
24
+ CONSTRAINT "org_users_org_id_user_id_unique" UNIQUE("org_id","user_id")
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE TABLE "organizations" (
28
+ "id" text PRIMARY KEY NOT NULL,
29
+ "external_id" text,
30
+ "name" text NOT NULL,
31
+ "slug" text NOT NULL,
32
+ "owner_id" text NOT NULL,
33
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
34
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
35
+ CONSTRAINT "organizations_external_id_unique" UNIQUE("external_id"),
36
+ CONSTRAINT "organizations_slug_unique" UNIQUE("slug")
37
+ );
38
+ --> statement-breakpoint
39
+ CREATE TABLE "activities" (
40
+ "org_id" text NOT NULL,
41
+ "id" text NOT NULL,
42
+ "module_id" text NOT NULL,
43
+ "course_id" text NOT NULL,
44
+ "seq" integer NOT NULL,
45
+ "settings" jsonb,
46
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
47
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
48
+ CONSTRAINT "activities_org_id_id_pk" PRIMARY KEY("org_id","id"),
49
+ CONSTRAINT "activities_org_id_module_id_seq_unique" UNIQUE("org_id","module_id","seq")
50
+ );
51
+ --> statement-breakpoint
52
+ CREATE TABLE "activity_assets" (
53
+ "org_id" text NOT NULL,
54
+ "id" text NOT NULL,
55
+ "activity_id" text NOT NULL,
56
+ "asset_id" text NOT NULL,
57
+ "seq" integer DEFAULT 0 NOT NULL,
58
+ CONSTRAINT "activity_assets_org_id_id_pk" PRIMARY KEY("org_id","id"),
59
+ CONSTRAINT "activity_assets_org_id_activity_id_asset_id_unique" UNIQUE("org_id","activity_id","asset_id")
60
+ );
61
+ --> statement-breakpoint
62
+ CREATE TABLE "content_items" (
63
+ "org_id" text NOT NULL,
64
+ "id" text NOT NULL,
65
+ "type" text NOT NULL,
66
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
67
+ CONSTRAINT "content_items_org_id_id_pk" PRIMARY KEY("org_id","id"),
68
+ CONSTRAINT "content_items_org_id_id_type_unique" UNIQUE("org_id","id","type"),
69
+ CONSTRAINT "content_items_type_check" CHECK ("content_items"."type" in ('course', 'download'))
70
+ );
71
+ --> statement-breakpoint
72
+ CREATE TABLE "courses" (
73
+ "org_id" text NOT NULL,
74
+ "id" text NOT NULL,
75
+ "type" text GENERATED ALWAYS AS ('course') STORED NOT NULL,
76
+ "title" text NOT NULL,
77
+ "slug" text NOT NULL,
78
+ "description" text DEFAULT '' NOT NULL,
79
+ "status" text DEFAULT 'draft' NOT NULL,
80
+ "category" text DEFAULT '' NOT NULL,
81
+ "thumbnail_asset_id" text,
82
+ "settings" jsonb DEFAULT '{}'::jsonb NOT NULL,
83
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
84
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
85
+ CONSTRAINT "courses_org_id_id_pk" PRIMARY KEY("org_id","id"),
86
+ CONSTRAINT "courses_org_id_slug_unique" UNIQUE("org_id","slug")
87
+ );
88
+ --> statement-breakpoint
89
+ CREATE TABLE "download_assets" (
90
+ "org_id" text NOT NULL,
91
+ "id" text NOT NULL,
92
+ "download_id" text NOT NULL,
93
+ "asset_id" text NOT NULL,
94
+ "seq" integer DEFAULT 0 NOT NULL,
95
+ "display_name" text,
96
+ CONSTRAINT "download_assets_org_id_id_pk" PRIMARY KEY("org_id","id"),
97
+ CONSTRAINT "download_assets_org_id_download_id_asset_id_unique" UNIQUE("org_id","download_id","asset_id")
98
+ );
99
+ --> statement-breakpoint
100
+ CREATE TABLE "downloads" (
101
+ "org_id" text NOT NULL,
102
+ "id" text NOT NULL,
103
+ "type" text GENERATED ALWAYS AS ('download') STORED NOT NULL,
104
+ "title" text NOT NULL,
105
+ "slug" text NOT NULL,
106
+ "description" text DEFAULT '' NOT NULL,
107
+ "status" text DEFAULT 'draft' NOT NULL,
108
+ "category" text DEFAULT '' NOT NULL,
109
+ "thumbnail_asset_id" text,
110
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
111
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
112
+ CONSTRAINT "downloads_org_id_id_pk" PRIMARY KEY("org_id","id"),
113
+ CONSTRAINT "downloads_org_id_slug_unique" UNIQUE("org_id","slug")
114
+ );
115
+ --> statement-breakpoint
116
+ CREATE TABLE "modules" (
117
+ "org_id" text NOT NULL,
118
+ "id" text NOT NULL,
119
+ "course_id" text NOT NULL,
120
+ "title" text NOT NULL,
121
+ "seq" integer NOT NULL,
122
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
123
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
124
+ CONSTRAINT "modules_org_id_id_pk" PRIMARY KEY("org_id","id"),
125
+ CONSTRAINT "modules_org_id_id_course_id_unique" UNIQUE("org_id","id","course_id")
126
+ );
127
+ --> statement-breakpoint
128
+ CREATE TABLE "entitlements" (
129
+ "org_id" text NOT NULL,
130
+ "id" text NOT NULL,
131
+ "org_user_id" text NOT NULL,
132
+ "content_id" text NOT NULL,
133
+ "status" text DEFAULT 'active' NOT NULL,
134
+ "source" text DEFAULT 'manual' NOT NULL,
135
+ "granted_at" timestamp with time zone DEFAULT now() NOT NULL,
136
+ "expires_at" timestamp with time zone,
137
+ CONSTRAINT "entitlements_org_id_id_pk" PRIMARY KEY("org_id","id"),
138
+ CONSTRAINT "entitlements_org_id_org_user_id_content_id_unique" UNIQUE("org_id","org_user_id","content_id")
139
+ );
140
+ --> statement-breakpoint
141
+ CREATE TABLE "progress_records" (
142
+ "org_id" text NOT NULL,
143
+ "id" text NOT NULL,
144
+ "org_user_id" text NOT NULL,
145
+ "target_type" text NOT NULL,
146
+ "target_id" text NOT NULL,
147
+ "started_at" timestamp with time zone DEFAULT now() NOT NULL,
148
+ "position" jsonb,
149
+ "completed_at" timestamp with time zone,
150
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
151
+ CONSTRAINT "progress_records_org_id_id_pk" PRIMARY KEY("org_id","id"),
152
+ CONSTRAINT "progress_records_org_id_org_user_id_target_type_target_id_unique" UNIQUE("org_id","org_user_id","target_type","target_id")
153
+ );
154
+ --> statement-breakpoint
155
+ CREATE TABLE "users" (
156
+ "id" text PRIMARY KEY NOT NULL,
157
+ "external_id" text,
158
+ "email" text NOT NULL,
159
+ "first_name" text,
160
+ "last_name" text,
161
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
162
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
163
+ CONSTRAINT "users_external_id_unique" UNIQUE("external_id"),
164
+ CONSTRAINT "users_email_unique" UNIQUE("email")
165
+ );
166
+ --> statement-breakpoint
167
+ CREATE TABLE "assets" (
168
+ "org_id" text NOT NULL,
169
+ "id" text NOT NULL,
170
+ "key" text NOT NULL,
171
+ "kind" text NOT NULL,
172
+ "filename" text NOT NULL,
173
+ "content_type" text NOT NULL,
174
+ "size" bigint DEFAULT 0 NOT NULL,
175
+ "status" text DEFAULT 'pending' NOT NULL,
176
+ "uploaded_by" text NOT NULL,
177
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
178
+ CONSTRAINT "assets_org_id_id_pk" PRIMARY KEY("org_id","id")
179
+ );
180
+ --> statement-breakpoint
181
+ CREATE TABLE "credentials" (
182
+ "org_id" text NOT NULL,
183
+ "id" text NOT NULL,
184
+ "ciphertext" text NOT NULL,
185
+ "key_version" integer DEFAULT 1 NOT NULL,
186
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
187
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
188
+ CONSTRAINT "credentials_org_id_id_pk" PRIMARY KEY("org_id","id")
189
+ );
190
+ --> statement-breakpoint
191
+ CREATE TABLE "connections" (
192
+ "org_id" text NOT NULL,
193
+ "id" text NOT NULL,
194
+ "integration_id" text NOT NULL,
195
+ "config" jsonb DEFAULT '{}'::jsonb NOT NULL,
196
+ "active" boolean DEFAULT true NOT NULL,
197
+ "credential_ref" text NOT NULL,
198
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
199
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
200
+ CONSTRAINT "connections_org_id_id_pk" PRIMARY KEY("org_id","id"),
201
+ CONSTRAINT "connections_org_id_integration_id_unique" UNIQUE("org_id","integration_id")
202
+ );
203
+ --> statement-breakpoint
204
+ CREATE TABLE "event_outbox" (
205
+ "org_id" text NOT NULL,
206
+ "id" text PRIMARY KEY NOT NULL,
207
+ "type" text NOT NULL,
208
+ "payload" jsonb NOT NULL,
209
+ "attempts" integer DEFAULT 0 NOT NULL,
210
+ "next_attempt_at" timestamp with time zone DEFAULT now() NOT NULL,
211
+ "last_error" text,
212
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
213
+ "processed_at" timestamp with time zone
214
+ );
215
+ --> statement-breakpoint
216
+ CREATE TABLE "automation_runs" (
217
+ "org_id" text NOT NULL,
218
+ "id" text NOT NULL,
219
+ "automation_id" text NOT NULL,
220
+ "trigger" text NOT NULL,
221
+ "event_id" text NOT NULL,
222
+ "event" jsonb NOT NULL,
223
+ "status" text NOT NULL,
224
+ "action_results" jsonb DEFAULT '[]'::jsonb NOT NULL,
225
+ "started_at" timestamp with time zone NOT NULL,
226
+ "finished_at" timestamp with time zone,
227
+ CONSTRAINT "automation_runs_org_id_id_pk" PRIMARY KEY("org_id","id")
228
+ );
229
+ --> statement-breakpoint
230
+ CREATE TABLE "automations" (
231
+ "org_id" text NOT NULL,
232
+ "id" text NOT NULL,
233
+ "name" text NOT NULL,
234
+ "description" text,
235
+ "trigger" text NOT NULL,
236
+ "actions" jsonb NOT NULL,
237
+ "enabled" boolean DEFAULT true NOT NULL,
238
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
239
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
240
+ CONSTRAINT "automations_org_id_id_pk" PRIMARY KEY("org_id","id")
241
+ );
242
+ --> statement-breakpoint
243
+ CREATE TABLE "settings" (
244
+ "org_id" text NOT NULL,
245
+ "namespace" text NOT NULL,
246
+ "scope_id" text NOT NULL,
247
+ "value" jsonb DEFAULT '{}'::jsonb NOT NULL,
248
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
249
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
250
+ CONSTRAINT "settings_org_id_namespace_scope_id_pk" PRIMARY KEY("org_id","namespace","scope_id")
251
+ );
252
+ --> statement-breakpoint
253
+ CREATE TABLE "comment_reactions" (
254
+ "org_id" text NOT NULL,
255
+ "comment_id" text NOT NULL,
256
+ "org_user_id" text NOT NULL,
257
+ "emoji" text NOT NULL,
258
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
259
+ CONSTRAINT "comment_reactions_org_id_comment_id_org_user_id_pk" PRIMARY KEY("org_id","comment_id","org_user_id")
260
+ );
261
+ --> statement-breakpoint
262
+ CREATE TABLE "comment_reports" (
263
+ "org_id" text NOT NULL,
264
+ "id" text NOT NULL,
265
+ "comment_id" text NOT NULL,
266
+ "org_user_id" text NOT NULL,
267
+ "reason" text DEFAULT '' NOT NULL,
268
+ "resolved_at" timestamp with time zone,
269
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
270
+ CONSTRAINT "comment_reports_org_id_id_pk" PRIMARY KEY("org_id","id"),
271
+ CONSTRAINT "comment_reports_org_id_comment_id_org_user_id_unique" UNIQUE("org_id","comment_id","org_user_id")
272
+ );
273
+ --> statement-breakpoint
274
+ CREATE TABLE "comments" (
275
+ "org_id" text NOT NULL,
276
+ "id" text NOT NULL,
277
+ "activity_id" text NOT NULL,
278
+ "parent_id" text,
279
+ "org_user_id" text NOT NULL,
280
+ "body" text NOT NULL,
281
+ "status" text DEFAULT 'published' NOT NULL,
282
+ "removed_by" text,
283
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
284
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
285
+ CONSTRAINT "comments_org_id_id_pk" PRIMARY KEY("org_id","id"),
286
+ CONSTRAINT "comments_removed_by_check" CHECK (("comments"."status" = 'removed') = ("comments"."removed_by" is not null))
287
+ );
288
+ --> statement-breakpoint
289
+ CREATE TABLE "ba_account" (
290
+ "id" text PRIMARY KEY NOT NULL,
291
+ "account_id" text NOT NULL,
292
+ "provider_id" text NOT NULL,
293
+ "user_id" text NOT NULL,
294
+ "access_token" text,
295
+ "refresh_token" text,
296
+ "id_token" text,
297
+ "access_token_expires_at" timestamp with time zone,
298
+ "refresh_token_expires_at" timestamp with time zone,
299
+ "scope" text,
300
+ "password" text,
301
+ "created_at" timestamp with time zone NOT NULL,
302
+ "updated_at" timestamp with time zone NOT NULL
303
+ );
304
+ --> statement-breakpoint
305
+ CREATE TABLE "ba_invitation" (
306
+ "id" text PRIMARY KEY NOT NULL,
307
+ "organization_id" text NOT NULL,
308
+ "email" text NOT NULL,
309
+ "role" text NOT NULL,
310
+ "status" text DEFAULT 'pending' NOT NULL,
311
+ "expires_at" timestamp with time zone,
312
+ "inviter_id" text NOT NULL,
313
+ "created_at" timestamp with time zone NOT NULL
314
+ );
315
+ --> statement-breakpoint
316
+ CREATE TABLE "ba_jwks" (
317
+ "id" text PRIMARY KEY NOT NULL,
318
+ "public_key" text NOT NULL,
319
+ "private_key" text NOT NULL,
320
+ "created_at" timestamp with time zone NOT NULL
321
+ );
322
+ --> statement-breakpoint
323
+ CREATE TABLE "ba_member" (
324
+ "id" text PRIMARY KEY NOT NULL,
325
+ "organization_id" text NOT NULL,
326
+ "user_id" text NOT NULL,
327
+ "role" text DEFAULT 'member' NOT NULL,
328
+ "created_at" timestamp with time zone NOT NULL
329
+ );
330
+ --> statement-breakpoint
331
+ CREATE TABLE "ba_oauth_access_token" (
332
+ "id" text PRIMARY KEY NOT NULL,
333
+ "token" text NOT NULL,
334
+ "client_id" text NOT NULL,
335
+ "session_id" text,
336
+ "user_id" text,
337
+ "reference_id" text,
338
+ "refresh_id" text,
339
+ "expires_at" timestamp with time zone NOT NULL,
340
+ "created_at" timestamp with time zone NOT NULL,
341
+ "scopes" text[] NOT NULL,
342
+ CONSTRAINT "ba_oauth_access_token_token_unique" UNIQUE("token")
343
+ );
344
+ --> statement-breakpoint
345
+ CREATE TABLE "ba_oauth_client" (
346
+ "id" text PRIMARY KEY NOT NULL,
347
+ "client_id" text NOT NULL,
348
+ "client_secret" text,
349
+ "disabled" boolean DEFAULT false,
350
+ "skip_consent" boolean,
351
+ "enable_end_session" boolean,
352
+ "subject_type" text,
353
+ "scopes" text[],
354
+ "user_id" text,
355
+ "name" text,
356
+ "uri" text,
357
+ "icon" text,
358
+ "contacts" text[],
359
+ "tos" text,
360
+ "policy" text,
361
+ "software_id" text,
362
+ "software_version" text,
363
+ "software_statement" text,
364
+ "redirect_uris" text[] NOT NULL,
365
+ "post_logout_redirect_uris" text[],
366
+ "token_endpoint_auth_method" text,
367
+ "grant_types" text[],
368
+ "response_types" text[],
369
+ "public" boolean,
370
+ "type" text,
371
+ "require_pkce" boolean,
372
+ "reference_id" text,
373
+ "metadata" text,
374
+ "created_at" timestamp with time zone,
375
+ "updated_at" timestamp with time zone,
376
+ CONSTRAINT "ba_oauth_client_client_id_unique" UNIQUE("client_id")
377
+ );
378
+ --> statement-breakpoint
379
+ CREATE TABLE "ba_oauth_consent" (
380
+ "id" text PRIMARY KEY NOT NULL,
381
+ "client_id" text NOT NULL,
382
+ "user_id" text,
383
+ "reference_id" text,
384
+ "scopes" text[] NOT NULL,
385
+ "created_at" timestamp with time zone NOT NULL,
386
+ "updated_at" timestamp with time zone NOT NULL
387
+ );
388
+ --> statement-breakpoint
389
+ CREATE TABLE "ba_oauth_refresh_token" (
390
+ "id" text PRIMARY KEY NOT NULL,
391
+ "token" text NOT NULL,
392
+ "client_id" text NOT NULL,
393
+ "session_id" text,
394
+ "user_id" text NOT NULL,
395
+ "reference_id" text,
396
+ "expires_at" timestamp with time zone NOT NULL,
397
+ "created_at" timestamp with time zone NOT NULL,
398
+ "revoked" timestamp with time zone,
399
+ "auth_time" timestamp with time zone,
400
+ "scopes" text[] NOT NULL,
401
+ CONSTRAINT "ba_oauth_refresh_token_token_unique" UNIQUE("token")
402
+ );
403
+ --> statement-breakpoint
404
+ CREATE TABLE "ba_organization" (
405
+ "id" text PRIMARY KEY NOT NULL,
406
+ "name" text NOT NULL,
407
+ "slug" text NOT NULL,
408
+ "logo" text,
409
+ "metadata" text,
410
+ "created_at" timestamp with time zone NOT NULL,
411
+ "updated_at" timestamp with time zone,
412
+ CONSTRAINT "ba_organization_slug_unique" UNIQUE("slug")
413
+ );
414
+ --> statement-breakpoint
415
+ CREATE TABLE "ba_session" (
416
+ "id" text PRIMARY KEY NOT NULL,
417
+ "expires_at" timestamp with time zone NOT NULL,
418
+ "token" text NOT NULL,
419
+ "created_at" timestamp with time zone NOT NULL,
420
+ "updated_at" timestamp with time zone NOT NULL,
421
+ "ip_address" text,
422
+ "user_agent" text,
423
+ "user_id" text NOT NULL,
424
+ "active_organization_id" text,
425
+ CONSTRAINT "ba_session_token_unique" UNIQUE("token")
426
+ );
427
+ --> statement-breakpoint
428
+ CREATE TABLE "ba_user" (
429
+ "id" text PRIMARY KEY NOT NULL,
430
+ "name" text NOT NULL,
431
+ "email" text NOT NULL,
432
+ "email_verified" boolean NOT NULL,
433
+ "image" text,
434
+ "created_at" timestamp with time zone NOT NULL,
435
+ "updated_at" timestamp with time zone NOT NULL,
436
+ CONSTRAINT "ba_user_email_unique" UNIQUE("email")
437
+ );
438
+ --> statement-breakpoint
439
+ CREATE TABLE "ba_verification" (
440
+ "id" text PRIMARY KEY NOT NULL,
441
+ "identifier" text NOT NULL,
442
+ "value" text NOT NULL,
443
+ "expires_at" timestamp with time zone NOT NULL,
444
+ "created_at" timestamp with time zone,
445
+ "updated_at" timestamp with time zone
446
+ );
447
+ --> statement-breakpoint
448
+ ALTER TABLE "invites" ADD CONSTRAINT "invites_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
449
+ ALTER TABLE "invites" ADD CONSTRAINT "invites_invited_by_users_id_fk" FOREIGN KEY ("invited_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
450
+ ALTER TABLE "org_users" ADD CONSTRAINT "org_users_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
451
+ ALTER TABLE "org_users" ADD CONSTRAINT "org_users_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
452
+ ALTER TABLE "organizations" ADD CONSTRAINT "organizations_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
453
+ ALTER TABLE "activities" ADD CONSTRAINT "activities_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
454
+ ALTER TABLE "activities" ADD CONSTRAINT "activities_org_id_module_id_course_id_modules_org_id_id_course_id_fk" FOREIGN KEY ("org_id","module_id","course_id") REFERENCES "public"."modules"("org_id","id","course_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
455
+ ALTER TABLE "activity_assets" ADD CONSTRAINT "activity_assets_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
456
+ ALTER TABLE "activity_assets" ADD CONSTRAINT "activity_assets_org_id_activity_id_activities_org_id_id_fk" FOREIGN KEY ("org_id","activity_id") REFERENCES "public"."activities"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
457
+ ALTER TABLE "activity_assets" ADD CONSTRAINT "activity_assets_org_id_asset_id_assets_org_id_id_fk" FOREIGN KEY ("org_id","asset_id") REFERENCES "public"."assets"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
458
+ ALTER TABLE "content_items" ADD CONSTRAINT "content_items_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
459
+ ALTER TABLE "courses" ADD CONSTRAINT "courses_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
460
+ ALTER TABLE "courses" ADD CONSTRAINT "courses_org_id_id_type_content_items_org_id_id_type_fk" FOREIGN KEY ("org_id","id","type") REFERENCES "public"."content_items"("org_id","id","type") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
461
+ ALTER TABLE "courses" ADD CONSTRAINT "courses_org_id_thumbnail_asset_id_assets_org_id_id_fk" FOREIGN KEY ("org_id","thumbnail_asset_id") REFERENCES "public"."assets"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
462
+ ALTER TABLE "download_assets" ADD CONSTRAINT "download_assets_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
463
+ ALTER TABLE "download_assets" ADD CONSTRAINT "download_assets_org_id_download_id_downloads_org_id_id_fk" FOREIGN KEY ("org_id","download_id") REFERENCES "public"."downloads"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
464
+ ALTER TABLE "download_assets" ADD CONSTRAINT "download_assets_org_id_asset_id_assets_org_id_id_fk" FOREIGN KEY ("org_id","asset_id") REFERENCES "public"."assets"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
465
+ ALTER TABLE "downloads" ADD CONSTRAINT "downloads_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
466
+ ALTER TABLE "downloads" ADD CONSTRAINT "downloads_org_id_id_type_content_items_org_id_id_type_fk" FOREIGN KEY ("org_id","id","type") REFERENCES "public"."content_items"("org_id","id","type") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
467
+ ALTER TABLE "downloads" ADD CONSTRAINT "downloads_org_id_thumbnail_asset_id_assets_org_id_id_fk" FOREIGN KEY ("org_id","thumbnail_asset_id") REFERENCES "public"."assets"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
468
+ ALTER TABLE "modules" ADD CONSTRAINT "modules_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
469
+ ALTER TABLE "modules" ADD CONSTRAINT "modules_org_id_course_id_courses_org_id_id_fk" FOREIGN KEY ("org_id","course_id") REFERENCES "public"."courses"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
470
+ ALTER TABLE "entitlements" ADD CONSTRAINT "entitlements_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
471
+ ALTER TABLE "entitlements" ADD CONSTRAINT "entitlements_org_id_content_id_content_items_org_id_id_fk" FOREIGN KEY ("org_id","content_id") REFERENCES "public"."content_items"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
472
+ ALTER TABLE "entitlements" ADD CONSTRAINT "entitlements_org_id_org_user_id_org_users_org_id_id_fk" FOREIGN KEY ("org_id","org_user_id") REFERENCES "public"."org_users"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
473
+ ALTER TABLE "progress_records" ADD CONSTRAINT "progress_records_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
474
+ ALTER TABLE "progress_records" ADD CONSTRAINT "progress_records_org_id_org_user_id_org_users_org_id_id_fk" FOREIGN KEY ("org_id","org_user_id") REFERENCES "public"."org_users"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
475
+ ALTER TABLE "assets" ADD CONSTRAINT "assets_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
476
+ ALTER TABLE "credentials" ADD CONSTRAINT "credentials_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
477
+ ALTER TABLE "connections" ADD CONSTRAINT "connections_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
478
+ ALTER TABLE "connections" ADD CONSTRAINT "connections_org_id_credential_ref_credentials_org_id_id_fk" FOREIGN KEY ("org_id","credential_ref") REFERENCES "public"."credentials"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
479
+ ALTER TABLE "automation_runs" ADD CONSTRAINT "automation_runs_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
480
+ ALTER TABLE "automations" ADD CONSTRAINT "automations_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
481
+ ALTER TABLE "settings" ADD CONSTRAINT "settings_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
482
+ ALTER TABLE "comment_reactions" ADD CONSTRAINT "comment_reactions_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
483
+ ALTER TABLE "comment_reactions" ADD CONSTRAINT "comment_reactions_org_id_comment_id_comments_org_id_id_fk" FOREIGN KEY ("org_id","comment_id") REFERENCES "public"."comments"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
484
+ ALTER TABLE "comment_reactions" ADD CONSTRAINT "comment_reactions_org_id_org_user_id_org_users_org_id_id_fk" FOREIGN KEY ("org_id","org_user_id") REFERENCES "public"."org_users"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
485
+ ALTER TABLE "comment_reports" ADD CONSTRAINT "comment_reports_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
486
+ ALTER TABLE "comment_reports" ADD CONSTRAINT "comment_reports_org_id_comment_id_comments_org_id_id_fk" FOREIGN KEY ("org_id","comment_id") REFERENCES "public"."comments"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
487
+ ALTER TABLE "comment_reports" ADD CONSTRAINT "comment_reports_org_id_org_user_id_org_users_org_id_id_fk" FOREIGN KEY ("org_id","org_user_id") REFERENCES "public"."org_users"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
488
+ ALTER TABLE "comments" ADD CONSTRAINT "comments_org_id_organizations_id_fk" FOREIGN KEY ("org_id") REFERENCES "public"."organizations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
489
+ ALTER TABLE "comments" ADD CONSTRAINT "comments_org_id_activity_id_activities_org_id_id_fk" FOREIGN KEY ("org_id","activity_id") REFERENCES "public"."activities"("org_id","id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
490
+ ALTER TABLE "comments" ADD CONSTRAINT "comments_org_id_org_user_id_org_users_org_id_id_fk" FOREIGN KEY ("org_id","org_user_id") REFERENCES "public"."org_users"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
491
+ ALTER TABLE "comments" ADD CONSTRAINT "comments_org_id_removed_by_org_users_org_id_id_fk" FOREIGN KEY ("org_id","removed_by") REFERENCES "public"."org_users"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
492
+ ALTER TABLE "comments" ADD CONSTRAINT "comments_org_id_parent_id_comments_org_id_id_fk" FOREIGN KEY ("org_id","parent_id") REFERENCES "public"."comments"("org_id","id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
493
+ ALTER TABLE "ba_account" ADD CONSTRAINT "ba_account_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
494
+ ALTER TABLE "ba_invitation" ADD CONSTRAINT "ba_invitation_organization_id_ba_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."ba_organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
495
+ ALTER TABLE "ba_invitation" ADD CONSTRAINT "ba_invitation_inviter_id_ba_user_id_fk" FOREIGN KEY ("inviter_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
496
+ ALTER TABLE "ba_member" ADD CONSTRAINT "ba_member_organization_id_ba_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."ba_organization"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
497
+ ALTER TABLE "ba_member" ADD CONSTRAINT "ba_member_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
498
+ ALTER TABLE "ba_oauth_access_token" ADD CONSTRAINT "ba_oauth_access_token_client_id_ba_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."ba_oauth_client"("client_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
499
+ ALTER TABLE "ba_oauth_access_token" ADD CONSTRAINT "ba_oauth_access_token_session_id_ba_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."ba_session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
500
+ ALTER TABLE "ba_oauth_access_token" ADD CONSTRAINT "ba_oauth_access_token_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
501
+ ALTER TABLE "ba_oauth_access_token" ADD CONSTRAINT "ba_oauth_access_token_refresh_id_ba_oauth_refresh_token_id_fk" FOREIGN KEY ("refresh_id") REFERENCES "public"."ba_oauth_refresh_token"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
502
+ ALTER TABLE "ba_oauth_client" ADD CONSTRAINT "ba_oauth_client_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
503
+ ALTER TABLE "ba_oauth_consent" ADD CONSTRAINT "ba_oauth_consent_client_id_ba_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."ba_oauth_client"("client_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
504
+ ALTER TABLE "ba_oauth_consent" ADD CONSTRAINT "ba_oauth_consent_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
505
+ ALTER TABLE "ba_oauth_refresh_token" ADD CONSTRAINT "ba_oauth_refresh_token_client_id_ba_oauth_client_client_id_fk" FOREIGN KEY ("client_id") REFERENCES "public"."ba_oauth_client"("client_id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
506
+ ALTER TABLE "ba_oauth_refresh_token" ADD CONSTRAINT "ba_oauth_refresh_token_session_id_ba_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."ba_session"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
507
+ ALTER TABLE "ba_oauth_refresh_token" ADD CONSTRAINT "ba_oauth_refresh_token_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
508
+ ALTER TABLE "ba_session" ADD CONSTRAINT "ba_session_user_id_ba_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."ba_user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
509
+ CREATE UNIQUE INDEX "invites_pending_email_uq" ON "invites" USING btree ("org_id","email") WHERE "invites"."status" = 'pending';--> statement-breakpoint
510
+ CREATE INDEX "event_outbox_pending_idx" ON "event_outbox" USING btree ("id") WHERE "event_outbox"."processed_at" is null;--> statement-breakpoint
511
+ CREATE INDEX "automation_runs_org_automation_idx" ON "automation_runs" USING btree ("org_id","automation_id");--> statement-breakpoint
512
+ CREATE UNIQUE INDEX "automation_runs_org_automation_event_idx" ON "automation_runs" USING btree ("org_id","automation_id","event_id");--> statement-breakpoint
513
+ CREATE INDEX "automations_org_trigger_idx" ON "automations" USING btree ("org_id","trigger");--> statement-breakpoint
514
+ CREATE INDEX "comment_reports_open_idx" ON "comment_reports" USING btree ("org_id","comment_id","resolved_at");--> statement-breakpoint
515
+ CREATE INDEX "comments_activity_idx" ON "comments" USING btree ("org_id","activity_id","status","created_at");--> statement-breakpoint
516
+ CREATE INDEX "comments_queue_idx" ON "comments" USING btree ("org_id","status","created_at");--> statement-breakpoint
517
+ CREATE INDEX "ba_oauth_access_token_client_id_idx" ON "ba_oauth_access_token" USING btree ("client_id");--> statement-breakpoint
518
+ CREATE INDEX "ba_oauth_access_token_session_id_idx" ON "ba_oauth_access_token" USING btree ("session_id");--> statement-breakpoint
519
+ CREATE INDEX "ba_oauth_access_token_user_id_idx" ON "ba_oauth_access_token" USING btree ("user_id");--> statement-breakpoint
520
+ CREATE INDEX "ba_oauth_access_token_refresh_id_idx" ON "ba_oauth_access_token" USING btree ("refresh_id");--> statement-breakpoint
521
+ CREATE INDEX "ba_oauth_client_user_id_idx" ON "ba_oauth_client" USING btree ("user_id");--> statement-breakpoint
522
+ CREATE INDEX "ba_oauth_consent_client_id_idx" ON "ba_oauth_consent" USING btree ("client_id");--> statement-breakpoint
523
+ CREATE INDEX "ba_oauth_consent_user_id_idx" ON "ba_oauth_consent" USING btree ("user_id");--> statement-breakpoint
524
+ CREATE INDEX "ba_oauth_refresh_token_client_id_idx" ON "ba_oauth_refresh_token" USING btree ("client_id");--> statement-breakpoint
525
+ CREATE INDEX "ba_oauth_refresh_token_session_id_idx" ON "ba_oauth_refresh_token" USING btree ("session_id");--> statement-breakpoint
526
+ CREATE INDEX "ba_oauth_refresh_token_user_id_idx" ON "ba_oauth_refresh_token" USING btree ("user_id");