@meith/db 0.16.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 (205) hide show
  1. package/LICENSE.md +165 -0
  2. package/migrations/0000_initial_schema.sql +538 -0
  3. package/migrations/0001_seed_usergroups.sql +111 -0
  4. package/migrations/0002_group_promotions.sql +25 -0
  5. package/migrations/0003_counter_maintenance.sql +34 -0
  6. package/migrations/0004_post_render_cache.sql +7 -0
  7. package/migrations/0005_reports.sql +51 -0
  8. package/migrations/0006_warnings.sql +91 -0
  9. package/migrations/0007_notifications.sql +44 -0
  10. package/migrations/0008_subscriptions.sql +48 -0
  11. package/migrations/0009_member_preferences.sql +13 -0
  12. package/migrations/0010_profile_fields.sql +53 -0
  13. package/migrations/0011_private_messages.sql +63 -0
  14. package/migrations/0012_user_relations.sql +18 -0
  15. package/migrations/0013_reputation.sql +45 -0
  16. package/migrations/0014_signatures.sql +16 -0
  17. package/migrations/0015_admin_sessions.sql +24 -0
  18. package/migrations/0016_attachments.sql +51 -0
  19. package/migrations/0017_avatars.sql +33 -0
  20. package/migrations/0018_mass_mail.sql +15 -0
  21. package/migrations/0019_word_filters.sql +8 -0
  22. package/migrations/0020_searches.sql +15 -0
  23. package/migrations/0021_presence_stats.sql +18 -0
  24. package/migrations/0022_api_tokens_webhooks.sql +58 -0
  25. package/migrations/0023_install_state.sql +6 -0
  26. package/migrations/0024_component_versions.sql +13 -0
  27. package/migrations/0025_import.sql +25 -0
  28. package/migrations/0026_polls.sql +40 -0
  29. package/migrations/0027_drafts.sql +13 -0
  30. package/migrations/0028_board_vocabulary.sql +32 -0
  31. package/migrations/0029_announcements.sql +16 -0
  32. package/migrations/0030_antispam.sql +18 -0
  33. package/migrations/0031_markdown.sql +24 -0
  34. package/migrations/0032_theme_enablement.sql +1 -0
  35. package/migrations/0033_group_identity.sql +5 -0
  36. package/migrations/0034_search_document_version.sql +4 -0
  37. package/migrations/0035_categories_hold_no_threads.sql +1 -0
  38. package/migrations/0036_expiring_group_grants.sql +6 -0
  39. package/migrations/0037_automatic_timezone.sql +3 -0
  40. package/migrations/0038_primary_group_grants.sql +3 -0
  41. package/migrations/0039_moderator_log_forum_scope.sql +1 -0
  42. package/migrations/0040_moderator_restore_grants.sql +1 -0
  43. package/migrations/0041_drop_placebo_moderator_rights.sql +3 -0
  44. package/migrations/0042_drop_placebo_delete_others.sql +2 -0
  45. package/migrations/0043_federated_identity.sql +28 -0
  46. package/migrations/0044_second_factor.sql +34 -0
  47. package/migrations/0045_drop_dead_task_due_index.sql +1 -0
  48. package/migrations/0046_member_locale.sql +1 -0
  49. package/migrations/0047_navigation_items.sql +34 -0
  50. package/migrations/0048_web_push.sql +16 -0
  51. package/migrations/0049_plugin_health.sql +7 -0
  52. package/migrations/0050_drop_forum_password_grants.sql +1 -0
  53. package/migrations/0051_glossy_barracuda.sql +1 -0
  54. package/migrations/0052_many_professor_monster.sql +2 -0
  55. package/migrations/0053_strange_maximus.sql +14 -0
  56. package/migrations/0054_legacy_import_sources.sql +25 -0
  57. package/migrations/0055_poll_parity.sql +14 -0
  58. package/migrations/0056_marketplace_catalog.sql +11 -0
  59. package/migrations/meta/0000_snapshot.json +4412 -0
  60. package/migrations/meta/0006_snapshot.json +5411 -0
  61. package/migrations/meta/0007_snapshot.json +5634 -0
  62. package/migrations/meta/0008_snapshot.json +5779 -0
  63. package/migrations/meta/0009_snapshot.json +5816 -0
  64. package/migrations/meta/0010_snapshot.json +6117 -0
  65. package/migrations/meta/0011_snapshot.json +6406 -0
  66. package/migrations/meta/0012_snapshot.json +6517 -0
  67. package/migrations/meta/0013_snapshot.json +6722 -0
  68. package/migrations/meta/0014_snapshot.json +6777 -0
  69. package/migrations/meta/0015_snapshot.json +6914 -0
  70. package/migrations/meta/0016_snapshot.json +7192 -0
  71. package/migrations/meta/0017_snapshot.json +7248 -0
  72. package/migrations/meta/0018_snapshot.json +7355 -0
  73. package/migrations/meta/0019_snapshot.json +7419 -0
  74. package/migrations/meta/0020_snapshot.json +7562 -0
  75. package/migrations/meta/0021_snapshot.json +7653 -0
  76. package/migrations/meta/0031_snapshot.json +8162 -0
  77. package/migrations/meta/0032_snapshot.json +8169 -0
  78. package/migrations/meta/0033_snapshot.json +8193 -0
  79. package/migrations/meta/0034_snapshot.json +8221 -0
  80. package/migrations/meta/0036_snapshot.json +8262 -0
  81. package/migrations/meta/0037_snapshot.json +8262 -0
  82. package/migrations/meta/0038_snapshot.json +8293 -0
  83. package/migrations/meta/0039_snapshot.json +8308 -0
  84. package/migrations/meta/0041_snapshot.json +8287 -0
  85. package/migrations/meta/0042_snapshot.json +8274 -0
  86. package/migrations/meta/0043_snapshot.json +8521 -0
  87. package/migrations/meta/0044_snapshot.json +8814 -0
  88. package/migrations/meta/0045_snapshot.json +8797 -0
  89. package/migrations/meta/0046_snapshot.json +8804 -0
  90. package/migrations/meta/0047_snapshot.json +9018 -0
  91. package/migrations/meta/0048_snapshot.json +9145 -0
  92. package/migrations/meta/0049_snapshot.json +9190 -0
  93. package/migrations/meta/0050_snapshot.json +9126 -0
  94. package/migrations/meta/0051_snapshot.json +9132 -0
  95. package/migrations/meta/0052_snapshot.json +9148 -0
  96. package/migrations/meta/0053_snapshot.json +9268 -0
  97. package/migrations/meta/0054_snapshot.json +9378 -0
  98. package/migrations/meta/0056_snapshot.json +9447 -0
  99. package/migrations/meta/_journal.json +405 -0
  100. package/package.json +64 -0
  101. package/src/account-repos.ts +580 -0
  102. package/src/actor-builder.ts +130 -0
  103. package/src/admin-repo.ts +85 -0
  104. package/src/admin-session-repo.ts +205 -0
  105. package/src/admin-undo-repo.ts +128 -0
  106. package/src/announcement-repo.ts +176 -0
  107. package/src/antispam-repo.ts +145 -0
  108. package/src/api-repo.ts +276 -0
  109. package/src/attachment-admin-repo.ts +161 -0
  110. package/src/attachment-repo.ts +240 -0
  111. package/src/authorization-source.ts +138 -0
  112. package/src/avatar-repo.ts +185 -0
  113. package/src/ban-repos.ts +146 -0
  114. package/src/client.ts +85 -0
  115. package/src/content-admin-repo.ts +298 -0
  116. package/src/content-counters.ts +152 -0
  117. package/src/counter-recount.ts +263 -0
  118. package/src/cursor.ts +16 -0
  119. package/src/denormalised-username.ts +34 -0
  120. package/src/discovery-repo.ts +140 -0
  121. package/src/draft-repo.ts +59 -0
  122. package/src/feed-repo.ts +219 -0
  123. package/src/forum-admin-repo.ts +310 -0
  124. package/src/forum-repo.ts +206 -0
  125. package/src/group-admin-repo.ts +256 -0
  126. package/src/group-identity-repo.ts +84 -0
  127. package/src/identity-link-repo.ts +145 -0
  128. package/src/import-repo.ts +123 -0
  129. package/src/import-sink.ts +1377 -0
  130. package/src/index.ts +316 -0
  131. package/src/inline-moderation.ts +344 -0
  132. package/src/install-repo.ts +67 -0
  133. package/src/latest-repo.ts +115 -0
  134. package/src/maintenance-repo.ts +54 -0
  135. package/src/marketplace-repo.ts +111 -0
  136. package/src/member-profile-repo.ts +82 -0
  137. package/src/member-settings-repo.ts +160 -0
  138. package/src/message-repo.ts +384 -0
  139. package/src/migrate-run.ts +18 -0
  140. package/src/migrate.ts +129 -0
  141. package/src/modcp-repo.ts +253 -0
  142. package/src/moderation-queue.ts +279 -0
  143. package/src/navigation-repo.ts +288 -0
  144. package/src/notification-repo.ts +402 -0
  145. package/src/orphan-keys.ts +19 -0
  146. package/src/outbox-repo.ts +78 -0
  147. package/src/permission-version.ts +24 -0
  148. package/src/permissions-map.ts +52 -0
  149. package/src/pglite.fixture.ts +87 -0
  150. package/src/plugin-data.ts +88 -0
  151. package/src/plugin-grants.ts +369 -0
  152. package/src/plugin-health-repo.ts +80 -0
  153. package/src/plugin-purge-repo.ts +91 -0
  154. package/src/plugin-users.ts +39 -0
  155. package/src/poll-repo.ts +334 -0
  156. package/src/post-repo.ts +261 -0
  157. package/src/post-writes.ts +227 -0
  158. package/src/presence-repo.ts +220 -0
  159. package/src/profile-field-repo.ts +182 -0
  160. package/src/promotion-repo.ts +152 -0
  161. package/src/read-state-repo.ts +81 -0
  162. package/src/relation-repo.ts +113 -0
  163. package/src/render-backfill.ts +110 -0
  164. package/src/render-signature.ts +33 -0
  165. package/src/report-repo.ts +349 -0
  166. package/src/reputation-repo.ts +295 -0
  167. package/src/result-rows.ts +13 -0
  168. package/src/row-values.ts +7 -0
  169. package/src/schema/content.ts +451 -0
  170. package/src/schema/identity.ts +699 -0
  171. package/src/schema/index.ts +10 -0
  172. package/src/schema/messages.ts +76 -0
  173. package/src/schema/permission-columns.ts +34 -0
  174. package/src/schema/platform.ts +376 -0
  175. package/src/schema/structure.ts +164 -0
  176. package/src/search-repo.ts +359 -0
  177. package/src/search-store.ts +113 -0
  178. package/src/seed-groups.ts +11 -0
  179. package/src/settings-repo.ts +32 -0
  180. package/src/signature-repo.ts +102 -0
  181. package/src/sql-lists.ts +17 -0
  182. package/src/staff-groups.ts +50 -0
  183. package/src/stats-repo.ts +151 -0
  184. package/src/subscription-repo.ts +350 -0
  185. package/src/system-health-repo.ts +130 -0
  186. package/src/task-repo.ts +104 -0
  187. package/src/theme-admin-repo.ts +172 -0
  188. package/src/theme-repo.ts +43 -0
  189. package/src/thread-audience.ts +45 -0
  190. package/src/thread-counters.ts +107 -0
  191. package/src/thread-repo.ts +255 -0
  192. package/src/thread-surgery.ts +282 -0
  193. package/src/thread-tools.ts +311 -0
  194. package/src/thread-views.ts +41 -0
  195. package/src/thread-writes.ts +356 -0
  196. package/src/two-factor-repo.ts +235 -0
  197. package/src/upgrade-repo.ts +66 -0
  198. package/src/user-admin-repo.ts +367 -0
  199. package/src/user-bulk-repo.ts +397 -0
  200. package/src/user-merge-map.ts +111 -0
  201. package/src/user-merge-repo.ts +304 -0
  202. package/src/visibility-counters.ts +190 -0
  203. package/src/visibility.ts +17 -0
  204. package/src/vocabulary-repo.ts +54 -0
  205. package/src/warning-repo.ts +328 -0
@@ -0,0 +1,538 @@
1
+ CREATE TABLE "ban_filters" (
2
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "ban_filters_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
3
+ "type" text NOT NULL,
4
+ "pattern" text NOT NULL,
5
+ "note" text,
6
+ "created_by_user_id" integer,
7
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE TABLE "bans" (
11
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "bans_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
12
+ "user_id" integer NOT NULL,
13
+ "banned_by_user_id" integer,
14
+ "reason" text,
15
+ "public_reason" text,
16
+ "previous_primary_group_id" integer,
17
+ "expires_at" timestamp with time zone,
18
+ "lifted_at" timestamp with time zone,
19
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE TABLE "credential_tokens" (
23
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "credential_tokens_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
24
+ "token_hash" text NOT NULL,
25
+ "user_id" integer NOT NULL,
26
+ "purpose" text NOT NULL,
27
+ "payload" text,
28
+ "consumed_at" timestamp with time zone,
29
+ "expires_at" timestamp with time zone NOT NULL,
30
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
31
+ );
32
+ --> statement-breakpoint
33
+ CREATE TABLE "login_attempts" (
34
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "login_attempts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
35
+ "bucket" text NOT NULL,
36
+ "succeeded" boolean NOT NULL,
37
+ "occurred_at" timestamp with time zone DEFAULT now() NOT NULL
38
+ );
39
+ --> statement-breakpoint
40
+ CREATE TABLE "remember_tokens" (
41
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "remember_tokens_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
42
+ "token_hash" text NOT NULL,
43
+ "family_id" text NOT NULL,
44
+ "user_id" integer NOT NULL,
45
+ "used_at" timestamp with time zone,
46
+ "revoked_at" timestamp with time zone,
47
+ "revoked_reason" text,
48
+ "expires_at" timestamp with time zone NOT NULL,
49
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
50
+ );
51
+ --> statement-breakpoint
52
+ CREATE TABLE "sessions" (
53
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "sessions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
54
+ "token_hash" text NOT NULL,
55
+ "user_id" integer,
56
+ "location_path" text,
57
+ "location_forum_id" integer,
58
+ "location_thread_id" integer,
59
+ "ip_prefix" text,
60
+ "user_agent" text,
61
+ "superseded_by_session_id" integer,
62
+ "last_seen_at" timestamp with time zone DEFAULT now() NOT NULL,
63
+ "expires_at" timestamp with time zone NOT NULL,
64
+ "revoked_at" timestamp with time zone,
65
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
66
+ );
67
+ --> statement-breakpoint
68
+ CREATE TABLE "user_group_memberships" (
69
+ "user_id" integer NOT NULL,
70
+ "group_id" integer NOT NULL,
71
+ "is_display_group" boolean DEFAULT false NOT NULL,
72
+ "granted_by_user_id" integer,
73
+ "granted_at" timestamp with time zone DEFAULT now() NOT NULL
74
+ );
75
+ --> statement-breakpoint
76
+ CREATE TABLE "usergroups" (
77
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "usergroups_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
78
+ "key" text NOT NULL,
79
+ "title" text NOT NULL,
80
+ "description" text,
81
+ "badge_token" text,
82
+ "display_order" integer DEFAULT 0 NOT NULL,
83
+ "is_system" boolean DEFAULT false NOT NULL,
84
+ "is_staff_group" boolean DEFAULT false NOT NULL,
85
+ "can_view" boolean DEFAULT false NOT NULL,
86
+ "can_view_threads" boolean DEFAULT false NOT NULL,
87
+ "can_view_others_threads" boolean DEFAULT false NOT NULL,
88
+ "can_search" boolean DEFAULT false NOT NULL,
89
+ "can_post_threads" boolean DEFAULT false NOT NULL,
90
+ "can_post_replies" boolean DEFAULT false NOT NULL,
91
+ "can_post_polls" boolean DEFAULT false NOT NULL,
92
+ "can_vote_polls" boolean DEFAULT false NOT NULL,
93
+ "can_rate_threads" boolean DEFAULT false NOT NULL,
94
+ "can_edit_own_posts" boolean DEFAULT false NOT NULL,
95
+ "can_delete_own_posts" boolean DEFAULT false NOT NULL,
96
+ "can_delete_own_threads" boolean DEFAULT false NOT NULL,
97
+ "can_edit_others_posts" boolean DEFAULT false NOT NULL,
98
+ "can_delete_others_posts" boolean DEFAULT false NOT NULL,
99
+ "can_soft_delete_posts" boolean DEFAULT false NOT NULL,
100
+ "can_view_unapproved" boolean DEFAULT false NOT NULL,
101
+ "can_view_deleted" boolean DEFAULT false NOT NULL,
102
+ "can_approve_content" boolean DEFAULT false NOT NULL,
103
+ "can_upload_attachments" boolean DEFAULT false NOT NULL,
104
+ "can_download_attachments" boolean DEFAULT false NOT NULL,
105
+ "can_subscribe" boolean DEFAULT false NOT NULL,
106
+ "can_view_profiles" boolean DEFAULT false NOT NULL,
107
+ "can_view_member_list" boolean DEFAULT false NOT NULL,
108
+ "can_use_private_messages" boolean DEFAULT false NOT NULL,
109
+ "can_use_signature" boolean DEFAULT false NOT NULL,
110
+ "can_upload_avatar" boolean DEFAULT false NOT NULL,
111
+ "can_report_content" boolean DEFAULT false NOT NULL,
112
+ "can_view_board_offline" boolean DEFAULT false NOT NULL,
113
+ "can_bypass_flood_check" boolean DEFAULT false NOT NULL,
114
+ "can_access_mod_cp" boolean DEFAULT false NOT NULL,
115
+ "is_super_moderator" boolean DEFAULT false NOT NULL,
116
+ "is_administrator" boolean DEFAULT false NOT NULL,
117
+ "can_access_admin_cp" boolean DEFAULT false NOT NULL,
118
+ "max_posts_per_day" integer DEFAULT 0 NOT NULL,
119
+ "edit_time_limit_minutes" integer DEFAULT 0 NOT NULL,
120
+ "max_attachments_per_post" integer DEFAULT 0 NOT NULL,
121
+ "max_attachment_size_kb" integer DEFAULT 0 NOT NULL,
122
+ "max_private_messages_per_day" integer DEFAULT 0 NOT NULL,
123
+ "max_signature_length" integer DEFAULT 0 NOT NULL,
124
+ "requires_thread_approval" boolean DEFAULT true NOT NULL,
125
+ "requires_post_approval" boolean DEFAULT true NOT NULL,
126
+ "requires_approval_on_edit" boolean DEFAULT true NOT NULL,
127
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
128
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
129
+ );
130
+ --> statement-breakpoint
131
+ CREATE TABLE "users" (
132
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
133
+ "username" text NOT NULL,
134
+ "username_lower" text NOT NULL,
135
+ "email" text NOT NULL,
136
+ "email_lower" text NOT NULL,
137
+ "password_hash" text,
138
+ "password_algo" text,
139
+ "password_changed_at" timestamp with time zone,
140
+ "primary_group_id" integer NOT NULL,
141
+ "display_group_id" integer,
142
+ "state" text DEFAULT 'active' NOT NULL,
143
+ "post_count" integer DEFAULT 0 NOT NULL,
144
+ "thread_count" integer DEFAULT 0 NOT NULL,
145
+ "reputation" integer DEFAULT 0 NOT NULL,
146
+ "warning_points" smallint DEFAULT 0 NOT NULL,
147
+ "registration_ip_prefix" text,
148
+ "last_ip_prefix" text,
149
+ "last_active_at" timestamp with time zone,
150
+ "email_verified_at" timestamp with time zone,
151
+ "deleted_at" timestamp with time zone,
152
+ "legacy_mybb_uid" integer,
153
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
154
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
155
+ );
156
+ --> statement-breakpoint
157
+ CREATE TABLE "forum_moderators" (
158
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "forum_moderators_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
159
+ "forum_id" integer NOT NULL,
160
+ "user_id" integer,
161
+ "group_id" integer,
162
+ "cascade_to_subforums" boolean DEFAULT false NOT NULL,
163
+ "can_edit_posts" boolean DEFAULT false NOT NULL,
164
+ "can_soft_delete_posts" boolean DEFAULT false NOT NULL,
165
+ "can_restore_posts" boolean DEFAULT false NOT NULL,
166
+ "can_hard_delete_posts" boolean DEFAULT false NOT NULL,
167
+ "can_approve_content" boolean DEFAULT false NOT NULL,
168
+ "can_open_close_threads" boolean DEFAULT false NOT NULL,
169
+ "can_stick_threads" boolean DEFAULT false NOT NULL,
170
+ "can_move_threads" boolean DEFAULT false NOT NULL,
171
+ "can_merge_threads" boolean DEFAULT false NOT NULL,
172
+ "can_split_threads" boolean DEFAULT false NOT NULL,
173
+ "can_manage_polls" boolean DEFAULT false NOT NULL,
174
+ "can_view_ips" boolean DEFAULT false NOT NULL,
175
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
176
+ );
177
+ --> statement-breakpoint
178
+ CREATE TABLE "forum_password_grants" (
179
+ "session_id" integer NOT NULL,
180
+ "forum_id" integer NOT NULL,
181
+ "granted_at" timestamp with time zone DEFAULT now() NOT NULL
182
+ );
183
+ --> statement-breakpoint
184
+ CREATE TABLE "forum_permissions" (
185
+ "forum_id" integer NOT NULL,
186
+ "group_id" integer NOT NULL,
187
+ "can_view" boolean,
188
+ "can_view_threads" boolean,
189
+ "can_view_others_threads" boolean,
190
+ "can_search" boolean,
191
+ "can_post_threads" boolean,
192
+ "can_post_replies" boolean,
193
+ "can_post_polls" boolean,
194
+ "can_vote_polls" boolean,
195
+ "can_rate_threads" boolean,
196
+ "can_edit_own_posts" boolean,
197
+ "can_delete_own_posts" boolean,
198
+ "can_delete_own_threads" boolean,
199
+ "can_edit_others_posts" boolean,
200
+ "can_delete_others_posts" boolean,
201
+ "can_soft_delete_posts" boolean,
202
+ "can_view_unapproved" boolean,
203
+ "can_view_deleted" boolean,
204
+ "can_approve_content" boolean,
205
+ "can_upload_attachments" boolean,
206
+ "can_download_attachments" boolean,
207
+ "can_subscribe" boolean,
208
+ "edit_time_limit_minutes" integer,
209
+ "max_attachments_per_post" integer,
210
+ "max_attachment_size_kb" integer,
211
+ "requires_thread_approval" boolean,
212
+ "requires_post_approval" boolean,
213
+ "requires_approval_on_edit" boolean,
214
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
215
+ );
216
+ --> statement-breakpoint
217
+ CREATE TABLE "forum_subscriptions" (
218
+ "user_id" integer NOT NULL,
219
+ "forum_id" integer NOT NULL,
220
+ "notify_via" text DEFAULT 'notification' NOT NULL,
221
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
222
+ );
223
+ --> statement-breakpoint
224
+ CREATE TABLE "forums" (
225
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "forums_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
226
+ "type" text DEFAULT 'forum' NOT NULL,
227
+ "title" text NOT NULL,
228
+ "description" text,
229
+ "slug" text NOT NULL,
230
+ "parent_id" integer,
231
+ "path" text NOT NULL,
232
+ "depth" integer DEFAULT 0 NOT NULL,
233
+ "display_order" integer DEFAULT 0 NOT NULL,
234
+ "link_url" text,
235
+ "link_hits" integer DEFAULT 0 NOT NULL,
236
+ "is_open" boolean DEFAULT true NOT NULL,
237
+ "allow_threads" boolean DEFAULT true NOT NULL,
238
+ "allow_replies" boolean DEFAULT true NOT NULL,
239
+ "allow_polls" boolean DEFAULT true NOT NULL,
240
+ "allow_attachments" boolean DEFAULT true NOT NULL,
241
+ "requires_prefix" boolean DEFAULT false NOT NULL,
242
+ "moderate_new_threads" boolean DEFAULT false NOT NULL,
243
+ "moderate_new_posts" boolean DEFAULT false NOT NULL,
244
+ "password_hash" text,
245
+ "thread_count" integer DEFAULT 0 NOT NULL,
246
+ "post_count" integer DEFAULT 0 NOT NULL,
247
+ "last_post_id" integer,
248
+ "last_post_thread_id" integer,
249
+ "last_post_thread_title" text,
250
+ "last_post_user_id" integer,
251
+ "last_post_username" text,
252
+ "last_post_at" timestamp with time zone,
253
+ "legacy_mybb_fid" integer,
254
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
255
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
256
+ );
257
+ --> statement-breakpoint
258
+ CREATE TABLE "forums_read" (
259
+ "user_id" integer NOT NULL,
260
+ "forum_id" integer NOT NULL,
261
+ "read_at" timestamp with time zone DEFAULT now() NOT NULL
262
+ );
263
+ --> statement-breakpoint
264
+ CREATE TABLE "post_revisions" (
265
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "post_revisions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
266
+ "post_id" integer NOT NULL,
267
+ "revision" smallint NOT NULL,
268
+ "message" text NOT NULL,
269
+ "subject" text,
270
+ "edited_by_user_id" integer,
271
+ "edit_reason" text,
272
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
273
+ );
274
+ --> statement-breakpoint
275
+ CREATE TABLE "posts" (
276
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "posts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
277
+ "thread_id" integer NOT NULL,
278
+ "forum_id" integer NOT NULL,
279
+ "author_user_id" integer,
280
+ "author_username" text NOT NULL,
281
+ "subject" text,
282
+ "message" text NOT NULL,
283
+ "visibility" text DEFAULT 'visible' NOT NULL,
284
+ "is_first_post" boolean DEFAULT false NOT NULL,
285
+ "ip_prefix" text,
286
+ "edited_at" timestamp with time zone,
287
+ "edited_by_user_id" integer,
288
+ "edit_reason" text,
289
+ "revision_count" smallint DEFAULT 0 NOT NULL,
290
+ "search_vector" "tsvector",
291
+ "legacy_mybb_pid" integer,
292
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
293
+ );
294
+ --> statement-breakpoint
295
+ CREATE TABLE "thread_prefixes" (
296
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "thread_prefixes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
297
+ "label" text NOT NULL,
298
+ "token" text,
299
+ "display_order" integer DEFAULT 0 NOT NULL,
300
+ "forum_path_prefix" text,
301
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
302
+ );
303
+ --> statement-breakpoint
304
+ CREATE TABLE "thread_subscriptions" (
305
+ "user_id" integer NOT NULL,
306
+ "thread_id" integer NOT NULL,
307
+ "notify_via" text DEFAULT 'notification' NOT NULL,
308
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
309
+ );
310
+ --> statement-breakpoint
311
+ CREATE TABLE "threads" (
312
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "threads_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
313
+ "forum_id" integer NOT NULL,
314
+ "title" text NOT NULL,
315
+ "slug" text NOT NULL,
316
+ "prefix_id" integer,
317
+ "author_user_id" integer,
318
+ "author_username" text NOT NULL,
319
+ "visibility" text DEFAULT 'visible' NOT NULL,
320
+ "is_sticky" boolean DEFAULT false NOT NULL,
321
+ "is_locked" boolean DEFAULT false NOT NULL,
322
+ "first_post_id" integer,
323
+ "reply_count" integer DEFAULT 0 NOT NULL,
324
+ "view_count" integer DEFAULT 0 NOT NULL,
325
+ "last_post_id" integer,
326
+ "last_post_user_id" integer,
327
+ "last_post_username" text,
328
+ "last_post_at" timestamp with time zone DEFAULT now() NOT NULL,
329
+ "moved_to_thread_id" integer,
330
+ "legacy_mybb_tid" integer,
331
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
332
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
333
+ );
334
+ --> statement-breakpoint
335
+ CREATE TABLE "threads_read" (
336
+ "user_id" integer NOT NULL,
337
+ "thread_id" integer NOT NULL,
338
+ "last_read_post_id" integer,
339
+ "read_at" timestamp with time zone DEFAULT now() NOT NULL
340
+ );
341
+ --> statement-breakpoint
342
+ CREATE TABLE "admin_log" (
343
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "admin_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
344
+ "user_id" integer,
345
+ "action" text NOT NULL,
346
+ "detail" jsonb DEFAULT '{}'::jsonb NOT NULL,
347
+ "ip_prefix" text,
348
+ "correlation_id" text,
349
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
350
+ );
351
+ --> statement-breakpoint
352
+ CREATE TABLE "cache_versions" (
353
+ "key" text PRIMARY KEY NOT NULL,
354
+ "version" integer DEFAULT 1 NOT NULL,
355
+ "bumped_at" timestamp with time zone DEFAULT now() NOT NULL
356
+ );
357
+ --> statement-breakpoint
358
+ CREATE TABLE "jobs" (
359
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "jobs_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
360
+ "kind" text NOT NULL,
361
+ "payload" jsonb DEFAULT '{}'::jsonb NOT NULL,
362
+ "status" text DEFAULT 'pending' NOT NULL,
363
+ "idempotency_key" text,
364
+ "run_at" timestamp with time zone DEFAULT now() NOT NULL,
365
+ "attempts" smallint DEFAULT 0 NOT NULL,
366
+ "max_attempts" smallint DEFAULT 5 NOT NULL,
367
+ "locked_until" timestamp with time zone,
368
+ "locked_by" text,
369
+ "last_error" text,
370
+ "correlation_id" text,
371
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
372
+ "completed_at" timestamp with time zone
373
+ );
374
+ --> statement-breakpoint
375
+ CREATE TABLE "outbox" (
376
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "outbox_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
377
+ "topic" text NOT NULL,
378
+ "payload" jsonb NOT NULL,
379
+ "correlation_id" text,
380
+ "dispatched_at" timestamp with time zone,
381
+ "attempts" smallint DEFAULT 0 NOT NULL,
382
+ "last_error" text,
383
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL
384
+ );
385
+ --> statement-breakpoint
386
+ CREATE TABLE "setting_groups" (
387
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "setting_groups_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
388
+ "key" text NOT NULL,
389
+ "title" text NOT NULL,
390
+ "description" text,
391
+ "display_order" integer DEFAULT 0 NOT NULL
392
+ );
393
+ --> statement-breakpoint
394
+ CREATE TABLE "settings" (
395
+ "key" text PRIMARY KEY NOT NULL,
396
+ "value" text NOT NULL,
397
+ "group_key" text,
398
+ "updated_by_user_id" integer,
399
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
400
+ );
401
+ --> statement-breakpoint
402
+ CREATE TABLE "task_log" (
403
+ "id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "task_log_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
404
+ "task_key" text NOT NULL,
405
+ "succeeded" boolean NOT NULL,
406
+ "duration_ms" integer,
407
+ "detail" text,
408
+ "error" text,
409
+ "ran_at" timestamp with time zone DEFAULT now() NOT NULL
410
+ );
411
+ --> statement-breakpoint
412
+ CREATE TABLE "tasks" (
413
+ "key" text PRIMARY KEY NOT NULL,
414
+ "interval_seconds" integer NOT NULL,
415
+ "enabled" boolean DEFAULT true NOT NULL,
416
+ "last_run_at" timestamp with time zone,
417
+ "next_run_at" timestamp with time zone DEFAULT now() NOT NULL,
418
+ "locked_until" timestamp with time zone,
419
+ "consecutive_failures" smallint DEFAULT 0 NOT NULL
420
+ );
421
+ --> statement-breakpoint
422
+ CREATE TABLE "themes" (
423
+ "key" text PRIMARY KEY NOT NULL,
424
+ "title" text NOT NULL,
425
+ "token_overrides" jsonb DEFAULT '{}'::jsonb NOT NULL,
426
+ "branding" jsonb DEFAULT '{}'::jsonb NOT NULL,
427
+ "layout_options" jsonb DEFAULT '{}'::jsonb NOT NULL,
428
+ "custom_css" text,
429
+ "is_default" boolean DEFAULT false NOT NULL,
430
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
431
+ );
432
+ --> statement-breakpoint
433
+ ALTER TABLE "ban_filters" ADD CONSTRAINT "ban_filters_created_by_user_id_users_id_fk" FOREIGN KEY ("created_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
434
+ ALTER TABLE "bans" ADD CONSTRAINT "bans_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
435
+ ALTER TABLE "bans" ADD CONSTRAINT "bans_banned_by_user_id_users_id_fk" FOREIGN KEY ("banned_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
436
+ ALTER TABLE "bans" ADD CONSTRAINT "bans_previous_primary_group_id_usergroups_id_fk" FOREIGN KEY ("previous_primary_group_id") REFERENCES "public"."usergroups"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
437
+ ALTER TABLE "credential_tokens" ADD CONSTRAINT "credential_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
438
+ ALTER TABLE "remember_tokens" ADD CONSTRAINT "remember_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
439
+ ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
440
+ ALTER TABLE "user_group_memberships" ADD CONSTRAINT "user_group_memberships_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
441
+ ALTER TABLE "user_group_memberships" ADD CONSTRAINT "user_group_memberships_group_id_usergroups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."usergroups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
442
+ ALTER TABLE "user_group_memberships" ADD CONSTRAINT "user_group_memberships_granted_by_user_id_users_id_fk" FOREIGN KEY ("granted_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
443
+ ALTER TABLE "users" ADD CONSTRAINT "users_primary_group_id_usergroups_id_fk" FOREIGN KEY ("primary_group_id") REFERENCES "public"."usergroups"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint
444
+ ALTER TABLE "users" ADD CONSTRAINT "users_display_group_id_usergroups_id_fk" FOREIGN KEY ("display_group_id") REFERENCES "public"."usergroups"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
445
+ ALTER TABLE "forum_moderators" ADD CONSTRAINT "forum_moderators_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
446
+ ALTER TABLE "forum_moderators" ADD CONSTRAINT "forum_moderators_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
447
+ ALTER TABLE "forum_moderators" ADD CONSTRAINT "forum_moderators_group_id_usergroups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."usergroups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
448
+ ALTER TABLE "forum_password_grants" ADD CONSTRAINT "forum_password_grants_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
449
+ ALTER TABLE "forum_permissions" ADD CONSTRAINT "forum_permissions_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
450
+ ALTER TABLE "forum_permissions" ADD CONSTRAINT "forum_permissions_group_id_usergroups_id_fk" FOREIGN KEY ("group_id") REFERENCES "public"."usergroups"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
451
+ ALTER TABLE "forum_subscriptions" ADD CONSTRAINT "forum_subscriptions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
452
+ ALTER TABLE "forum_subscriptions" ADD CONSTRAINT "forum_subscriptions_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
453
+ ALTER TABLE "forums_read" ADD CONSTRAINT "forums_read_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
454
+ ALTER TABLE "forums_read" ADD CONSTRAINT "forums_read_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
455
+ ALTER TABLE "post_revisions" ADD CONSTRAINT "post_revisions_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
456
+ ALTER TABLE "post_revisions" ADD CONSTRAINT "post_revisions_edited_by_user_id_users_id_fk" FOREIGN KEY ("edited_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
457
+ ALTER TABLE "posts" ADD CONSTRAINT "posts_thread_id_threads_id_fk" FOREIGN KEY ("thread_id") REFERENCES "public"."threads"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
458
+ ALTER TABLE "posts" ADD CONSTRAINT "posts_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
459
+ ALTER TABLE "posts" ADD CONSTRAINT "posts_author_user_id_users_id_fk" FOREIGN KEY ("author_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
460
+ ALTER TABLE "posts" ADD CONSTRAINT "posts_edited_by_user_id_users_id_fk" FOREIGN KEY ("edited_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
461
+ ALTER TABLE "thread_subscriptions" ADD CONSTRAINT "thread_subscriptions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
462
+ ALTER TABLE "thread_subscriptions" ADD CONSTRAINT "thread_subscriptions_thread_id_threads_id_fk" FOREIGN KEY ("thread_id") REFERENCES "public"."threads"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
463
+ ALTER TABLE "threads" ADD CONSTRAINT "threads_forum_id_forums_id_fk" FOREIGN KEY ("forum_id") REFERENCES "public"."forums"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
464
+ ALTER TABLE "threads" ADD CONSTRAINT "threads_prefix_id_thread_prefixes_id_fk" FOREIGN KEY ("prefix_id") REFERENCES "public"."thread_prefixes"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
465
+ ALTER TABLE "threads" ADD CONSTRAINT "threads_author_user_id_users_id_fk" FOREIGN KEY ("author_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
466
+ ALTER TABLE "threads_read" ADD CONSTRAINT "threads_read_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
467
+ ALTER TABLE "threads_read" ADD CONSTRAINT "threads_read_thread_id_threads_id_fk" FOREIGN KEY ("thread_id") REFERENCES "public"."threads"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
468
+ ALTER TABLE "admin_log" ADD CONSTRAINT "admin_log_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
469
+ ALTER TABLE "settings" ADD CONSTRAINT "settings_updated_by_user_id_users_id_fk" FOREIGN KEY ("updated_by_user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
470
+ CREATE INDEX "ban_filters_type_idx" ON "ban_filters" USING btree ("type");--> statement-breakpoint
471
+ CREATE UNIQUE INDEX "ban_filters_type_pattern_key" ON "ban_filters" USING btree ("type","pattern");--> statement-breakpoint
472
+ CREATE UNIQUE INDEX "bans_active_user_key" ON "bans" USING btree ("user_id") WHERE "bans"."lifted_at" is null;--> statement-breakpoint
473
+ CREATE INDEX "bans_expires_idx" ON "bans" USING btree ("expires_at") WHERE "bans"."lifted_at" is null;--> statement-breakpoint
474
+ CREATE UNIQUE INDEX "credential_tokens_hash_key" ON "credential_tokens" USING btree ("token_hash");--> statement-breakpoint
475
+ CREATE INDEX "credential_tokens_user_purpose_idx" ON "credential_tokens" USING btree ("user_id","purpose");--> statement-breakpoint
476
+ CREATE INDEX "credential_tokens_expires_idx" ON "credential_tokens" USING btree ("expires_at");--> statement-breakpoint
477
+ CREATE INDEX "login_attempts_bucket_idx" ON "login_attempts" USING btree ("bucket","occurred_at");--> statement-breakpoint
478
+ CREATE UNIQUE INDEX "remember_tokens_hash_key" ON "remember_tokens" USING btree ("token_hash");--> statement-breakpoint
479
+ CREATE INDEX "remember_tokens_family_idx" ON "remember_tokens" USING btree ("family_id");--> statement-breakpoint
480
+ CREATE INDEX "remember_tokens_user_idx" ON "remember_tokens" USING btree ("user_id");--> statement-breakpoint
481
+ CREATE INDEX "remember_tokens_expires_idx" ON "remember_tokens" USING btree ("expires_at");--> statement-breakpoint
482
+ CREATE UNIQUE INDEX "sessions_token_hash_key" ON "sessions" USING btree ("token_hash");--> statement-breakpoint
483
+ CREATE INDEX "sessions_last_seen_idx" ON "sessions" USING btree ("last_seen_at");--> statement-breakpoint
484
+ CREATE INDEX "sessions_user_idx" ON "sessions" USING btree ("user_id");--> statement-breakpoint
485
+ CREATE INDEX "sessions_expires_idx" ON "sessions" USING btree ("expires_at");--> statement-breakpoint
486
+ CREATE UNIQUE INDEX "user_group_memberships_pkey" ON "user_group_memberships" USING btree ("user_id","group_id");--> statement-breakpoint
487
+ CREATE INDEX "user_group_memberships_user_idx" ON "user_group_memberships" USING btree ("user_id");--> statement-breakpoint
488
+ CREATE INDEX "user_group_memberships_group_idx" ON "user_group_memberships" USING btree ("group_id");--> statement-breakpoint
489
+ CREATE UNIQUE INDEX "usergroups_key_key" ON "usergroups" USING btree ("key");--> statement-breakpoint
490
+ CREATE INDEX "usergroups_display_order_idx" ON "usergroups" USING btree ("display_order");--> statement-breakpoint
491
+ CREATE UNIQUE INDEX "users_username_lower_key" ON "users" USING btree ("username_lower");--> statement-breakpoint
492
+ CREATE UNIQUE INDEX "users_email_lower_key" ON "users" USING btree ("email_lower");--> statement-breakpoint
493
+ CREATE UNIQUE INDEX "users_legacy_mybb_uid_key" ON "users" USING btree ("legacy_mybb_uid") WHERE "users"."legacy_mybb_uid" is not null;--> statement-breakpoint
494
+ CREATE INDEX "users_primary_group_idx" ON "users" USING btree ("primary_group_id");--> statement-breakpoint
495
+ CREATE INDEX "users_active_created_idx" ON "users" USING btree ("created_at") WHERE "users"."state" = 'active';--> statement-breakpoint
496
+ CREATE INDEX "users_last_active_idx" ON "users" USING btree ("last_active_at");--> statement-breakpoint
497
+ CREATE UNIQUE INDEX "forum_moderators_user_key" ON "forum_moderators" USING btree ("forum_id","user_id") WHERE "forum_moderators"."user_id" is not null;--> statement-breakpoint
498
+ CREATE UNIQUE INDEX "forum_moderators_group_key" ON "forum_moderators" USING btree ("forum_id","group_id") WHERE "forum_moderators"."group_id" is not null;--> statement-breakpoint
499
+ CREATE INDEX "forum_moderators_user_idx" ON "forum_moderators" USING btree ("user_id");--> statement-breakpoint
500
+ CREATE INDEX "forum_moderators_group_idx" ON "forum_moderators" USING btree ("group_id");--> statement-breakpoint
501
+ CREATE UNIQUE INDEX "forum_password_grants_pkey" ON "forum_password_grants" USING btree ("session_id","forum_id");--> statement-breakpoint
502
+ CREATE UNIQUE INDEX "forum_permissions_pkey" ON "forum_permissions" USING btree ("forum_id","group_id");--> statement-breakpoint
503
+ CREATE INDEX "forum_permissions_group_idx" ON "forum_permissions" USING btree ("group_id");--> statement-breakpoint
504
+ CREATE UNIQUE INDEX "forum_subscriptions_pkey" ON "forum_subscriptions" USING btree ("user_id","forum_id");--> statement-breakpoint
505
+ CREATE INDEX "forum_subscriptions_forum_idx" ON "forum_subscriptions" USING btree ("forum_id");--> statement-breakpoint
506
+ CREATE UNIQUE INDEX "forums_parent_slug_key" ON "forums" USING btree ("parent_id","slug") WHERE "forums"."parent_id" is not null;--> statement-breakpoint
507
+ CREATE UNIQUE INDEX "forums_root_slug_key" ON "forums" USING btree ("slug") WHERE "forums"."parent_id" is null;--> statement-breakpoint
508
+ CREATE INDEX "forums_parent_order_idx" ON "forums" USING btree ("parent_id","display_order");--> statement-breakpoint
509
+ CREATE INDEX "forums_path_idx" ON "forums" USING btree ("path");--> statement-breakpoint
510
+ CREATE UNIQUE INDEX "forums_legacy_mybb_fid_key" ON "forums" USING btree ("legacy_mybb_fid") WHERE "forums"."legacy_mybb_fid" is not null;--> statement-breakpoint
511
+ CREATE UNIQUE INDEX "forums_read_pkey" ON "forums_read" USING btree ("user_id","forum_id");--> statement-breakpoint
512
+ CREATE UNIQUE INDEX "post_revisions_post_revision_key" ON "post_revisions" USING btree ("post_id","revision");--> statement-breakpoint
513
+ CREATE INDEX "posts_thread_visible_idx" ON "posts" USING btree ("thread_id","id") WHERE "posts"."visibility" = 'visible';--> statement-breakpoint
514
+ CREATE INDEX "posts_thread_all_idx" ON "posts" USING btree ("thread_id","id");--> statement-breakpoint
515
+ CREATE INDEX "posts_author_idx" ON "posts" USING btree ("author_user_id","created_at" DESC NULLS LAST);--> statement-breakpoint
516
+ CREATE INDEX "posts_forum_visibility_idx" ON "posts" USING btree ("forum_id","created_at" DESC NULLS LAST) WHERE "posts"."visibility" <> 'visible';--> statement-breakpoint
517
+ CREATE UNIQUE INDEX "posts_legacy_mybb_pid_key" ON "posts" USING btree ("legacy_mybb_pid") WHERE "posts"."legacy_mybb_pid" is not null;--> statement-breakpoint
518
+ CREATE INDEX "posts_search_vector_idx" ON "posts" USING gin ("search_vector");--> statement-breakpoint
519
+ CREATE INDEX "thread_prefixes_order_idx" ON "thread_prefixes" USING btree ("display_order");--> statement-breakpoint
520
+ CREATE UNIQUE INDEX "thread_subscriptions_pkey" ON "thread_subscriptions" USING btree ("user_id","thread_id");--> statement-breakpoint
521
+ CREATE INDEX "thread_subscriptions_thread_idx" ON "thread_subscriptions" USING btree ("thread_id");--> statement-breakpoint
522
+ CREATE INDEX "threads_forum_listing_idx" ON "threads" USING btree ("forum_id","is_sticky" DESC NULLS LAST,"last_post_at" DESC NULLS LAST) WHERE "threads"."visibility" = 'visible';--> statement-breakpoint
523
+ CREATE INDEX "threads_forum_listing_all_idx" ON "threads" USING btree ("forum_id","is_sticky" DESC NULLS LAST,"last_post_at" DESC NULLS LAST);--> statement-breakpoint
524
+ CREATE INDEX "threads_author_idx" ON "threads" USING btree ("author_user_id","created_at" DESC NULLS LAST);--> statement-breakpoint
525
+ CREATE UNIQUE INDEX "threads_legacy_mybb_tid_key" ON "threads" USING btree ("legacy_mybb_tid") WHERE "threads"."legacy_mybb_tid" is not null;--> statement-breakpoint
526
+ CREATE UNIQUE INDEX "threads_read_pkey" ON "threads_read" USING btree ("user_id","thread_id");--> statement-breakpoint
527
+ CREATE INDEX "threads_read_read_at_idx" ON "threads_read" USING btree ("read_at");--> statement-breakpoint
528
+ CREATE INDEX "admin_log_user_idx" ON "admin_log" USING btree ("user_id","created_at" DESC NULLS LAST);--> statement-breakpoint
529
+ CREATE INDEX "admin_log_action_idx" ON "admin_log" USING btree ("action","created_at" DESC NULLS LAST);--> statement-breakpoint
530
+ CREATE INDEX "jobs_pending_idx" ON "jobs" USING btree ("status","run_at") WHERE "jobs"."status" = 'pending';--> statement-breakpoint
531
+ CREATE UNIQUE INDEX "jobs_idempotency_key" ON "jobs" USING btree ("idempotency_key") WHERE "jobs"."idempotency_key" is not null and "jobs"."status" = 'pending';--> statement-breakpoint
532
+ CREATE INDEX "jobs_status_idx" ON "jobs" USING btree ("status");--> statement-breakpoint
533
+ CREATE INDEX "outbox_pending_idx" ON "outbox" USING btree ("id") WHERE "outbox"."dispatched_at" is null;--> statement-breakpoint
534
+ CREATE UNIQUE INDEX "setting_groups_key_key" ON "setting_groups" USING btree ("key");--> statement-breakpoint
535
+ CREATE INDEX "settings_group_idx" ON "settings" USING btree ("group_key");--> statement-breakpoint
536
+ CREATE INDEX "task_log_key_ran_idx" ON "task_log" USING btree ("task_key","ran_at" DESC NULLS LAST);--> statement-breakpoint
537
+ CREATE INDEX "tasks_due_idx" ON "tasks" USING btree ("next_run_at") WHERE "tasks"."enabled";--> statement-breakpoint
538
+ CREATE UNIQUE INDEX "themes_single_default_key" ON "themes" USING btree ("is_default") WHERE "themes"."is_default";