@commonpub/schema 0.14.1 → 0.14.3
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.
|
@@ -0,0 +1,1291 @@
|
|
|
1
|
+
CREATE TYPE "public"."activity_direction" AS ENUM('inbound', 'outbound');--> statement-breakpoint
|
|
2
|
+
CREATE TYPE "public"."activity_status" AS ENUM('pending', 'delivered', 'failed', 'processed');--> statement-breakpoint
|
|
3
|
+
CREATE TYPE "public"."bookmark_target_type" AS ENUM('project', 'article', 'blog', 'explainer', 'learning_path');--> statement-breakpoint
|
|
4
|
+
CREATE TYPE "public"."comment_target_type" AS ENUM('project', 'article', 'blog', 'explainer', 'post', 'lesson', 'video');--> statement-breakpoint
|
|
5
|
+
CREATE TYPE "public"."content_status" AS ENUM('draft', 'published', 'archived');--> statement-breakpoint
|
|
6
|
+
CREATE TYPE "public"."content_type" AS ENUM('project', 'article', 'blog', 'explainer');--> statement-breakpoint
|
|
7
|
+
CREATE TYPE "public"."content_visibility" AS ENUM('public', 'members', 'private');--> statement-breakpoint
|
|
8
|
+
CREATE TYPE "public"."contest_status" AS ENUM('upcoming', 'active', 'judging', 'completed', 'cancelled');--> statement-breakpoint
|
|
9
|
+
CREATE TYPE "public"."difficulty" AS ENUM('beginner', 'intermediate', 'advanced');--> statement-breakpoint
|
|
10
|
+
CREATE TYPE "public"."docs_page_status" AS ENUM('draft', 'published', 'archived');--> statement-breakpoint
|
|
11
|
+
CREATE TYPE "public"."event_attendee_status" AS ENUM('registered', 'waitlisted', 'cancelled', 'attended');--> statement-breakpoint
|
|
12
|
+
CREATE TYPE "public"."event_status" AS ENUM('draft', 'published', 'active', 'completed', 'cancelled');--> statement-breakpoint
|
|
13
|
+
CREATE TYPE "public"."event_type" AS ENUM('in-person', 'online', 'hybrid');--> statement-breakpoint
|
|
14
|
+
CREATE TYPE "public"."file_purpose" AS ENUM('cover', 'content', 'avatar', 'banner', 'attachment');--> statement-breakpoint
|
|
15
|
+
CREATE TYPE "public"."follow_relationship_status" AS ENUM('pending', 'accepted', 'rejected');--> statement-breakpoint
|
|
16
|
+
CREATE TYPE "public"."hub_follow_status" AS ENUM('pending', 'joined');--> statement-breakpoint
|
|
17
|
+
CREATE TYPE "public"."hub_join_policy" AS ENUM('open', 'approval', 'invite');--> statement-breakpoint
|
|
18
|
+
CREATE TYPE "public"."hub_member_status" AS ENUM('pending', 'active');--> statement-breakpoint
|
|
19
|
+
CREATE TYPE "public"."hub_privacy" AS ENUM('public', 'unlisted', 'private');--> statement-breakpoint
|
|
20
|
+
CREATE TYPE "public"."hub_role" AS ENUM('owner', 'admin', 'moderator', 'member');--> statement-breakpoint
|
|
21
|
+
CREATE TYPE "public"."hub_type" AS ENUM('community', 'product', 'company');--> statement-breakpoint
|
|
22
|
+
CREATE TYPE "public"."judge_role" AS ENUM('lead', 'judge', 'guest');--> statement-breakpoint
|
|
23
|
+
CREATE TYPE "public"."judging_visibility" AS ENUM('public', 'judges-only', 'private');--> statement-breakpoint
|
|
24
|
+
CREATE TYPE "public"."lesson_type" AS ENUM('article', 'video', 'quiz', 'project', 'explainer');--> statement-breakpoint
|
|
25
|
+
CREATE TYPE "public"."like_target_type" AS ENUM('project', 'article', 'blog', 'explainer', 'comment', 'post', 'video');--> statement-breakpoint
|
|
26
|
+
CREATE TYPE "public"."mirror_direction" AS ENUM('pull', 'push');--> statement-breakpoint
|
|
27
|
+
CREATE TYPE "public"."mirror_status" AS ENUM('pending', 'active', 'paused', 'failed');--> statement-breakpoint
|
|
28
|
+
CREATE TYPE "public"."notification_type" AS ENUM('like', 'comment', 'follow', 'mention', 'contest', 'event', 'certificate', 'hub', 'system', 'fork', 'build');--> statement-breakpoint
|
|
29
|
+
CREATE TYPE "public"."post_type" AS ENUM('text', 'link', 'share', 'poll', 'discussion', 'question', 'showcase', 'announcement');--> statement-breakpoint
|
|
30
|
+
CREATE TYPE "public"."product_category" AS ENUM('microcontroller', 'sbc', 'sensor', 'actuator', 'display', 'communication', 'power', 'mechanical', 'software', 'tool', 'other');--> statement-breakpoint
|
|
31
|
+
CREATE TYPE "public"."product_status" AS ENUM('active', 'discontinued', 'preview');--> statement-breakpoint
|
|
32
|
+
CREATE TYPE "public"."profile_visibility" AS ENUM('public', 'members', 'private');--> statement-breakpoint
|
|
33
|
+
CREATE TYPE "public"."report_reason" AS ENUM('spam', 'harassment', 'inappropriate', 'copyright', 'other');--> statement-breakpoint
|
|
34
|
+
CREATE TYPE "public"."report_status" AS ENUM('pending', 'reviewed', 'resolved', 'dismissed');--> statement-breakpoint
|
|
35
|
+
CREATE TYPE "public"."report_target_type" AS ENUM('project', 'article', 'blog', 'post', 'comment', 'user', 'explainer');--> statement-breakpoint
|
|
36
|
+
CREATE TYPE "public"."resource_category" AS ENUM('documentation', 'tools', 'tutorials', 'community', 'hardware', 'software', 'other');--> statement-breakpoint
|
|
37
|
+
CREATE TYPE "public"."tag_category" AS ENUM('platform', 'language', 'framework', 'topic', 'general');--> statement-breakpoint
|
|
38
|
+
CREATE TYPE "public"."user_role" AS ENUM('member', 'pro', 'verified', 'staff', 'admin');--> statement-breakpoint
|
|
39
|
+
CREATE TYPE "public"."user_status" AS ENUM('active', 'suspended', 'deleted');--> statement-breakpoint
|
|
40
|
+
CREATE TYPE "public"."video_platform" AS ENUM('youtube', 'vimeo', 'other');--> statement-breakpoint
|
|
41
|
+
CREATE TYPE "public"."vote_direction" AS ENUM('up', 'down');--> statement-breakpoint
|
|
42
|
+
CREATE TABLE "audit_logs" (
|
|
43
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
44
|
+
"user_id" uuid NOT NULL,
|
|
45
|
+
"action" varchar(64) NOT NULL,
|
|
46
|
+
"target_type" varchar(64) NOT NULL,
|
|
47
|
+
"target_id" varchar(255),
|
|
48
|
+
"metadata" jsonb,
|
|
49
|
+
"ip_address" varchar(45),
|
|
50
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
51
|
+
);
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
CREATE TABLE "instance_settings" (
|
|
54
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
55
|
+
"key" varchar(128) NOT NULL,
|
|
56
|
+
"value" jsonb NOT NULL,
|
|
57
|
+
"updated_by" uuid,
|
|
58
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
59
|
+
CONSTRAINT "instance_settings_key_unique" UNIQUE("key")
|
|
60
|
+
);
|
|
61
|
+
--> statement-breakpoint
|
|
62
|
+
CREATE TABLE "accounts" (
|
|
63
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
64
|
+
"user_id" uuid NOT NULL,
|
|
65
|
+
"provider_id" varchar(32) NOT NULL,
|
|
66
|
+
"account_id" varchar(255) NOT NULL,
|
|
67
|
+
"access_token" text,
|
|
68
|
+
"refresh_token" text,
|
|
69
|
+
"password" text,
|
|
70
|
+
"expires_at" timestamp with time zone,
|
|
71
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
72
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
73
|
+
);
|
|
74
|
+
--> statement-breakpoint
|
|
75
|
+
CREATE TABLE "federated_accounts" (
|
|
76
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
77
|
+
"user_id" uuid NOT NULL,
|
|
78
|
+
"actor_uri" text NOT NULL,
|
|
79
|
+
"instance_domain" varchar(255) NOT NULL,
|
|
80
|
+
"preferred_username" varchar(64),
|
|
81
|
+
"display_name" varchar(128),
|
|
82
|
+
"avatar_url" text,
|
|
83
|
+
"last_synced_at" timestamp with time zone,
|
|
84
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
85
|
+
CONSTRAINT "federated_accounts_actor_uri_unique" UNIQUE("actor_uri")
|
|
86
|
+
);
|
|
87
|
+
--> statement-breakpoint
|
|
88
|
+
CREATE TABLE "members" (
|
|
89
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
90
|
+
"organization_id" uuid NOT NULL,
|
|
91
|
+
"user_id" uuid NOT NULL,
|
|
92
|
+
"role" varchar(32) DEFAULT 'member' NOT NULL,
|
|
93
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
94
|
+
);
|
|
95
|
+
--> statement-breakpoint
|
|
96
|
+
CREATE TABLE "oauth_clients" (
|
|
97
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
98
|
+
"client_id" varchar(255) NOT NULL,
|
|
99
|
+
"client_secret" varchar(512) NOT NULL,
|
|
100
|
+
"redirect_uris" jsonb NOT NULL,
|
|
101
|
+
"instance_domain" varchar(255) NOT NULL,
|
|
102
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
103
|
+
CONSTRAINT "oauth_clients_client_id_unique" UNIQUE("client_id")
|
|
104
|
+
);
|
|
105
|
+
--> statement-breakpoint
|
|
106
|
+
CREATE TABLE "oauth_codes" (
|
|
107
|
+
"code" varchar(255) PRIMARY KEY NOT NULL,
|
|
108
|
+
"user_id" uuid NOT NULL,
|
|
109
|
+
"client_id" varchar(255) NOT NULL,
|
|
110
|
+
"redirect_uri" text NOT NULL,
|
|
111
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
112
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
113
|
+
);
|
|
114
|
+
--> statement-breakpoint
|
|
115
|
+
CREATE TABLE "organizations" (
|
|
116
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
117
|
+
"name" varchar(128) NOT NULL,
|
|
118
|
+
"slug" varchar(128) NOT NULL,
|
|
119
|
+
"logo_url" text,
|
|
120
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
121
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
122
|
+
CONSTRAINT "organizations_slug_unique" UNIQUE("slug")
|
|
123
|
+
);
|
|
124
|
+
--> statement-breakpoint
|
|
125
|
+
CREATE TABLE "sessions" (
|
|
126
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
127
|
+
"user_id" uuid NOT NULL,
|
|
128
|
+
"token" varchar(512) NOT NULL,
|
|
129
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
130
|
+
"ip_address" varchar(45),
|
|
131
|
+
"user_agent" text,
|
|
132
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
133
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
134
|
+
CONSTRAINT "sessions_token_unique" UNIQUE("token")
|
|
135
|
+
);
|
|
136
|
+
--> statement-breakpoint
|
|
137
|
+
CREATE TABLE "users" (
|
|
138
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
139
|
+
"email" varchar(255) NOT NULL,
|
|
140
|
+
"email_verified" boolean DEFAULT false NOT NULL,
|
|
141
|
+
"username" varchar(64) NOT NULL,
|
|
142
|
+
"display_username" varchar(64),
|
|
143
|
+
"display_name" varchar(128),
|
|
144
|
+
"bio" text,
|
|
145
|
+
"headline" varchar(255),
|
|
146
|
+
"location" varchar(128),
|
|
147
|
+
"website" varchar(512),
|
|
148
|
+
"avatar_url" text,
|
|
149
|
+
"banner_url" text,
|
|
150
|
+
"social_links" jsonb,
|
|
151
|
+
"role" "user_role" DEFAULT 'member' NOT NULL,
|
|
152
|
+
"status" "user_status" DEFAULT 'active' NOT NULL,
|
|
153
|
+
"profile_visibility" "profile_visibility" DEFAULT 'public' NOT NULL,
|
|
154
|
+
"skills" jsonb,
|
|
155
|
+
"experience" jsonb,
|
|
156
|
+
"theme" varchar(64),
|
|
157
|
+
"pronouns" varchar(32),
|
|
158
|
+
"timezone" varchar(64),
|
|
159
|
+
"email_notifications" jsonb,
|
|
160
|
+
"deleted_at" timestamp with time zone,
|
|
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_email_unique" UNIQUE("email"),
|
|
164
|
+
CONSTRAINT "users_username_unique" UNIQUE("username")
|
|
165
|
+
);
|
|
166
|
+
--> statement-breakpoint
|
|
167
|
+
CREATE TABLE "verifications" (
|
|
168
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
169
|
+
"identifier" varchar(255) NOT NULL,
|
|
170
|
+
"value" text NOT NULL,
|
|
171
|
+
"expires_at" timestamp with time zone NOT NULL,
|
|
172
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
173
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
174
|
+
);
|
|
175
|
+
--> statement-breakpoint
|
|
176
|
+
CREATE TABLE "content_builds" (
|
|
177
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
178
|
+
"content_id" uuid NOT NULL,
|
|
179
|
+
"user_id" uuid NOT NULL,
|
|
180
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
181
|
+
CONSTRAINT "content_builds_user_content" UNIQUE("user_id","content_id")
|
|
182
|
+
);
|
|
183
|
+
--> statement-breakpoint
|
|
184
|
+
CREATE TABLE "content_categories" (
|
|
185
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
186
|
+
"name" varchar(64) NOT NULL,
|
|
187
|
+
"slug" varchar(64) NOT NULL,
|
|
188
|
+
"description" varchar(255),
|
|
189
|
+
"color" varchar(32),
|
|
190
|
+
"icon" varchar(64),
|
|
191
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
192
|
+
"is_system" boolean DEFAULT false NOT NULL,
|
|
193
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
194
|
+
CONSTRAINT "content_categories_slug_unique" UNIQUE("slug")
|
|
195
|
+
);
|
|
196
|
+
--> statement-breakpoint
|
|
197
|
+
CREATE TABLE "content_forks" (
|
|
198
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
199
|
+
"source_id" uuid NOT NULL,
|
|
200
|
+
"fork_id" uuid NOT NULL,
|
|
201
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
202
|
+
);
|
|
203
|
+
--> statement-breakpoint
|
|
204
|
+
CREATE TABLE "content_items" (
|
|
205
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
206
|
+
"author_id" uuid NOT NULL,
|
|
207
|
+
"type" "content_type" NOT NULL,
|
|
208
|
+
"title" varchar(255) NOT NULL,
|
|
209
|
+
"slug" varchar(255) NOT NULL,
|
|
210
|
+
"subtitle" varchar(255),
|
|
211
|
+
"description" text,
|
|
212
|
+
"content" jsonb,
|
|
213
|
+
"cover_image_url" text,
|
|
214
|
+
"banner_url" text,
|
|
215
|
+
"category" varchar(64),
|
|
216
|
+
"difficulty" "difficulty",
|
|
217
|
+
"build_time" varchar(64),
|
|
218
|
+
"estimated_cost" varchar(64),
|
|
219
|
+
"status" "content_status" DEFAULT 'draft' NOT NULL,
|
|
220
|
+
"visibility" "content_visibility" DEFAULT 'public' NOT NULL,
|
|
221
|
+
"is_featured" boolean DEFAULT false NOT NULL,
|
|
222
|
+
"is_editorial" boolean DEFAULT false NOT NULL,
|
|
223
|
+
"editorial_note" varchar(255),
|
|
224
|
+
"category_id" uuid,
|
|
225
|
+
"seo_description" varchar(320),
|
|
226
|
+
"preview_token" varchar(64),
|
|
227
|
+
"parts" jsonb,
|
|
228
|
+
"sections" jsonb,
|
|
229
|
+
"license_type" varchar(32),
|
|
230
|
+
"series" varchar(128),
|
|
231
|
+
"estimated_minutes" integer,
|
|
232
|
+
"canonical_url" text,
|
|
233
|
+
"ap_object_id" text,
|
|
234
|
+
"deleted_at" timestamp with time zone,
|
|
235
|
+
"view_count" integer DEFAULT 0 NOT NULL,
|
|
236
|
+
"like_count" integer DEFAULT 0 NOT NULL,
|
|
237
|
+
"comment_count" integer DEFAULT 0 NOT NULL,
|
|
238
|
+
"fork_count" integer DEFAULT 0 NOT NULL,
|
|
239
|
+
"build_count" integer DEFAULT 0 NOT NULL,
|
|
240
|
+
"boost_count" integer DEFAULT 0 NOT NULL,
|
|
241
|
+
"published_at" timestamp with time zone,
|
|
242
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
243
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
244
|
+
CONSTRAINT "content_items_author_type_slug" UNIQUE("author_id","type","slug")
|
|
245
|
+
);
|
|
246
|
+
--> statement-breakpoint
|
|
247
|
+
CREATE TABLE "content_tags" (
|
|
248
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
249
|
+
"content_id" uuid NOT NULL,
|
|
250
|
+
"tag_id" uuid NOT NULL
|
|
251
|
+
);
|
|
252
|
+
--> statement-breakpoint
|
|
253
|
+
CREATE TABLE "content_versions" (
|
|
254
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
255
|
+
"content_id" uuid NOT NULL,
|
|
256
|
+
"version" integer NOT NULL,
|
|
257
|
+
"title" varchar(255),
|
|
258
|
+
"content" jsonb,
|
|
259
|
+
"metadata" jsonb,
|
|
260
|
+
"created_by_id" uuid NOT NULL,
|
|
261
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
262
|
+
);
|
|
263
|
+
--> statement-breakpoint
|
|
264
|
+
CREATE TABLE "tags" (
|
|
265
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
266
|
+
"name" varchar(64) NOT NULL,
|
|
267
|
+
"slug" varchar(64) NOT NULL,
|
|
268
|
+
"category" varchar(32),
|
|
269
|
+
"usage_count" integer DEFAULT 0 NOT NULL,
|
|
270
|
+
CONSTRAINT "tags_name_unique" UNIQUE("name"),
|
|
271
|
+
CONSTRAINT "tags_slug_unique" UNIQUE("slug")
|
|
272
|
+
);
|
|
273
|
+
--> statement-breakpoint
|
|
274
|
+
CREATE TABLE "contest_entries" (
|
|
275
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
276
|
+
"contest_id" uuid NOT NULL,
|
|
277
|
+
"content_id" uuid NOT NULL,
|
|
278
|
+
"user_id" uuid NOT NULL,
|
|
279
|
+
"score" integer,
|
|
280
|
+
"rank" integer,
|
|
281
|
+
"judge_scores" jsonb,
|
|
282
|
+
"submitted_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
283
|
+
CONSTRAINT "contest_entries_user_content" UNIQUE("contest_id","user_id","content_id")
|
|
284
|
+
);
|
|
285
|
+
--> statement-breakpoint
|
|
286
|
+
CREATE TABLE "contest_judges" (
|
|
287
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
288
|
+
"contest_id" uuid NOT NULL,
|
|
289
|
+
"user_id" uuid NOT NULL,
|
|
290
|
+
"role" "judge_role" DEFAULT 'judge' NOT NULL,
|
|
291
|
+
"invited_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
292
|
+
"accepted_at" timestamp with time zone,
|
|
293
|
+
CONSTRAINT "uq_contest_judges_contest_user" UNIQUE("contest_id","user_id")
|
|
294
|
+
);
|
|
295
|
+
--> statement-breakpoint
|
|
296
|
+
CREATE TABLE "contests" (
|
|
297
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
298
|
+
"title" varchar(255) NOT NULL,
|
|
299
|
+
"slug" varchar(255) NOT NULL,
|
|
300
|
+
"description" text,
|
|
301
|
+
"rules" text,
|
|
302
|
+
"banner_url" text,
|
|
303
|
+
"status" "contest_status" DEFAULT 'upcoming' NOT NULL,
|
|
304
|
+
"start_date" timestamp with time zone NOT NULL,
|
|
305
|
+
"end_date" timestamp with time zone NOT NULL,
|
|
306
|
+
"judging_end_date" timestamp with time zone,
|
|
307
|
+
"prizes" jsonb,
|
|
308
|
+
"judging_visibility" "judging_visibility" DEFAULT 'judges-only' NOT NULL,
|
|
309
|
+
"judges" jsonb,
|
|
310
|
+
"created_by_id" uuid NOT NULL,
|
|
311
|
+
"community_voting_enabled" boolean DEFAULT false NOT NULL,
|
|
312
|
+
"entry_count" integer DEFAULT 0 NOT NULL,
|
|
313
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
314
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
315
|
+
CONSTRAINT "contests_slug_unique" UNIQUE("slug")
|
|
316
|
+
);
|
|
317
|
+
--> statement-breakpoint
|
|
318
|
+
CREATE TABLE "docs_pages" (
|
|
319
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
320
|
+
"version_id" uuid NOT NULL,
|
|
321
|
+
"title" varchar(255) NOT NULL,
|
|
322
|
+
"slug" varchar(255) NOT NULL,
|
|
323
|
+
"sidebar_label" varchar(128),
|
|
324
|
+
"description" text,
|
|
325
|
+
"content" jsonb NOT NULL,
|
|
326
|
+
"status" "docs_page_status" DEFAULT 'draft' NOT NULL,
|
|
327
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
328
|
+
"parent_id" uuid,
|
|
329
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
330
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
331
|
+
CONSTRAINT "docs_pages_version_slug" UNIQUE("version_id","slug")
|
|
332
|
+
);
|
|
333
|
+
--> statement-breakpoint
|
|
334
|
+
CREATE TABLE "docs_sites" (
|
|
335
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
336
|
+
"name" varchar(128) NOT NULL,
|
|
337
|
+
"slug" varchar(128) NOT NULL,
|
|
338
|
+
"description" text,
|
|
339
|
+
"owner_id" uuid NOT NULL,
|
|
340
|
+
"theme_tokens" jsonb,
|
|
341
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
342
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
343
|
+
CONSTRAINT "docs_sites_slug_unique" UNIQUE("slug")
|
|
344
|
+
);
|
|
345
|
+
--> statement-breakpoint
|
|
346
|
+
CREATE TABLE "docs_versions" (
|
|
347
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
348
|
+
"site_id" uuid NOT NULL,
|
|
349
|
+
"version" varchar(32) NOT NULL,
|
|
350
|
+
"is_default" boolean DEFAULT false NOT NULL,
|
|
351
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
352
|
+
CONSTRAINT "docs_versions_site_version" UNIQUE("site_id","version")
|
|
353
|
+
);
|
|
354
|
+
--> statement-breakpoint
|
|
355
|
+
CREATE TABLE "event_attendees" (
|
|
356
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
357
|
+
"event_id" uuid NOT NULL,
|
|
358
|
+
"user_id" uuid NOT NULL,
|
|
359
|
+
"status" "event_attendee_status" DEFAULT 'registered' NOT NULL,
|
|
360
|
+
"registered_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
361
|
+
);
|
|
362
|
+
--> statement-breakpoint
|
|
363
|
+
CREATE TABLE "events" (
|
|
364
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
365
|
+
"title" varchar(255) NOT NULL,
|
|
366
|
+
"slug" varchar(255) NOT NULL,
|
|
367
|
+
"description" text,
|
|
368
|
+
"cover_image" text,
|
|
369
|
+
"event_type" "event_type" DEFAULT 'in-person' NOT NULL,
|
|
370
|
+
"status" "event_status" DEFAULT 'draft' NOT NULL,
|
|
371
|
+
"start_date" timestamp with time zone NOT NULL,
|
|
372
|
+
"end_date" timestamp with time zone NOT NULL,
|
|
373
|
+
"timezone" varchar(64) DEFAULT 'UTC' NOT NULL,
|
|
374
|
+
"location" varchar(500),
|
|
375
|
+
"location_url" varchar(500),
|
|
376
|
+
"online_url" varchar(500),
|
|
377
|
+
"capacity" integer,
|
|
378
|
+
"attendee_count" integer DEFAULT 0 NOT NULL,
|
|
379
|
+
"is_featured" boolean DEFAULT false NOT NULL,
|
|
380
|
+
"hub_id" uuid,
|
|
381
|
+
"created_by_id" uuid NOT NULL,
|
|
382
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
383
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
384
|
+
CONSTRAINT "events_slug_unique" UNIQUE("slug")
|
|
385
|
+
);
|
|
386
|
+
--> statement-breakpoint
|
|
387
|
+
CREATE TABLE "activities" (
|
|
388
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
389
|
+
"type" varchar(64) NOT NULL,
|
|
390
|
+
"actor_uri" text NOT NULL,
|
|
391
|
+
"object_uri" text,
|
|
392
|
+
"payload" jsonb NOT NULL,
|
|
393
|
+
"direction" "activity_direction" NOT NULL,
|
|
394
|
+
"status" "activity_status" DEFAULT 'pending' NOT NULL,
|
|
395
|
+
"attempts" integer DEFAULT 0 NOT NULL,
|
|
396
|
+
"error" text,
|
|
397
|
+
"locked_at" timestamp with time zone,
|
|
398
|
+
"dead_lettered_at" timestamp with time zone,
|
|
399
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
400
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
401
|
+
);
|
|
402
|
+
--> statement-breakpoint
|
|
403
|
+
CREATE TABLE "actor_keypairs" (
|
|
404
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
405
|
+
"user_id" uuid NOT NULL,
|
|
406
|
+
"public_key_pem" text NOT NULL,
|
|
407
|
+
"private_key_pem" text NOT NULL,
|
|
408
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
409
|
+
CONSTRAINT "actor_keypairs_user_id_unique" UNIQUE("user_id")
|
|
410
|
+
);
|
|
411
|
+
--> statement-breakpoint
|
|
412
|
+
CREATE TABLE "federated_content" (
|
|
413
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
414
|
+
"object_uri" text NOT NULL,
|
|
415
|
+
"actor_uri" text NOT NULL,
|
|
416
|
+
"remote_actor_id" uuid,
|
|
417
|
+
"origin_domain" varchar(255) NOT NULL,
|
|
418
|
+
"ap_type" varchar(32) NOT NULL,
|
|
419
|
+
"title" text,
|
|
420
|
+
"content" text,
|
|
421
|
+
"summary" text,
|
|
422
|
+
"url" text,
|
|
423
|
+
"cover_image_url" text,
|
|
424
|
+
"tags" jsonb DEFAULT '[]'::jsonb,
|
|
425
|
+
"attachments" jsonb DEFAULT '[]'::jsonb,
|
|
426
|
+
"in_reply_to" text,
|
|
427
|
+
"cpub_type" varchar(32),
|
|
428
|
+
"cpub_metadata" jsonb,
|
|
429
|
+
"cpub_blocks" jsonb,
|
|
430
|
+
"local_like_count" integer DEFAULT 0 NOT NULL,
|
|
431
|
+
"local_comment_count" integer DEFAULT 0 NOT NULL,
|
|
432
|
+
"local_boost_count" integer DEFAULT 0 NOT NULL,
|
|
433
|
+
"local_view_count" integer DEFAULT 0 NOT NULL,
|
|
434
|
+
"published_at" timestamp with time zone,
|
|
435
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
436
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
437
|
+
"deleted_at" timestamp with time zone,
|
|
438
|
+
"mirror_id" uuid,
|
|
439
|
+
"is_hidden" boolean DEFAULT false NOT NULL,
|
|
440
|
+
CONSTRAINT "federated_content_object_uri_unique" UNIQUE("object_uri")
|
|
441
|
+
);
|
|
442
|
+
--> statement-breakpoint
|
|
443
|
+
CREATE TABLE "federated_content_builds" (
|
|
444
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
445
|
+
"federated_content_id" uuid NOT NULL,
|
|
446
|
+
"user_id" uuid NOT NULL,
|
|
447
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
448
|
+
CONSTRAINT "fed_content_builds_user_content" UNIQUE("user_id","federated_content_id")
|
|
449
|
+
);
|
|
450
|
+
--> statement-breakpoint
|
|
451
|
+
CREATE TABLE "federated_hub_members" (
|
|
452
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
453
|
+
"federated_hub_id" uuid NOT NULL,
|
|
454
|
+
"remote_actor_id" uuid NOT NULL,
|
|
455
|
+
"discovered_via" varchar(32) DEFAULT 'post' NOT NULL,
|
|
456
|
+
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
457
|
+
CONSTRAINT "uq_fed_hub_members_hub_actor" UNIQUE("federated_hub_id","remote_actor_id")
|
|
458
|
+
);
|
|
459
|
+
--> statement-breakpoint
|
|
460
|
+
CREATE TABLE "federated_hub_post_likes" (
|
|
461
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
462
|
+
"post_id" uuid NOT NULL,
|
|
463
|
+
"user_id" uuid NOT NULL,
|
|
464
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
465
|
+
CONSTRAINT "uq_fed_hub_post_likes_post_user" UNIQUE("post_id","user_id")
|
|
466
|
+
);
|
|
467
|
+
--> statement-breakpoint
|
|
468
|
+
CREATE TABLE "federated_hub_post_replies" (
|
|
469
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
470
|
+
"federated_hub_post_id" uuid NOT NULL,
|
|
471
|
+
"author_id" uuid,
|
|
472
|
+
"remote_actor_uri" text,
|
|
473
|
+
"remote_actor_name" text,
|
|
474
|
+
"parent_id" uuid,
|
|
475
|
+
"content" text NOT NULL,
|
|
476
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
477
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
478
|
+
);
|
|
479
|
+
--> statement-breakpoint
|
|
480
|
+
CREATE TABLE "federated_hub_posts" (
|
|
481
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
482
|
+
"federated_hub_id" uuid NOT NULL,
|
|
483
|
+
"object_uri" text NOT NULL,
|
|
484
|
+
"actor_uri" text NOT NULL,
|
|
485
|
+
"remote_actor_id" uuid,
|
|
486
|
+
"content" text NOT NULL,
|
|
487
|
+
"post_type" varchar(32) DEFAULT 'text' NOT NULL,
|
|
488
|
+
"is_pinned" boolean DEFAULT false NOT NULL,
|
|
489
|
+
"local_like_count" integer DEFAULT 0 NOT NULL,
|
|
490
|
+
"local_reply_count" integer DEFAULT 0 NOT NULL,
|
|
491
|
+
"remote_like_count" integer DEFAULT 0 NOT NULL,
|
|
492
|
+
"remote_reply_count" integer DEFAULT 0 NOT NULL,
|
|
493
|
+
"published_at" timestamp with time zone,
|
|
494
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
495
|
+
"shared_content_meta" jsonb,
|
|
496
|
+
"deleted_at" timestamp with time zone,
|
|
497
|
+
CONSTRAINT "federated_hub_posts_object_uri_unique" UNIQUE("object_uri")
|
|
498
|
+
);
|
|
499
|
+
--> statement-breakpoint
|
|
500
|
+
CREATE TABLE "federated_hub_products" (
|
|
501
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
502
|
+
"federated_hub_id" uuid NOT NULL,
|
|
503
|
+
"object_uri" text NOT NULL,
|
|
504
|
+
"name" varchar(255) NOT NULL,
|
|
505
|
+
"slug" varchar(255) NOT NULL,
|
|
506
|
+
"description" text,
|
|
507
|
+
"category" varchar(32),
|
|
508
|
+
"image_url" text,
|
|
509
|
+
"purchase_url" text,
|
|
510
|
+
"datasheet_url" text,
|
|
511
|
+
"specs" jsonb,
|
|
512
|
+
"pricing" jsonb,
|
|
513
|
+
"status" varchar(32) DEFAULT 'active' NOT NULL,
|
|
514
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
515
|
+
CONSTRAINT "federated_hub_products_object_uri_unique" UNIQUE("object_uri")
|
|
516
|
+
);
|
|
517
|
+
--> statement-breakpoint
|
|
518
|
+
CREATE TABLE "federated_hub_resources" (
|
|
519
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
520
|
+
"federated_hub_id" uuid NOT NULL,
|
|
521
|
+
"object_uri" text NOT NULL,
|
|
522
|
+
"title" varchar(255) NOT NULL,
|
|
523
|
+
"url" text NOT NULL,
|
|
524
|
+
"description" text,
|
|
525
|
+
"category" varchar(32) DEFAULT 'other' NOT NULL,
|
|
526
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
527
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
528
|
+
CONSTRAINT "federated_hub_resources_object_uri_unique" UNIQUE("object_uri")
|
|
529
|
+
);
|
|
530
|
+
--> statement-breakpoint
|
|
531
|
+
CREATE TABLE "federated_hubs" (
|
|
532
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
533
|
+
"actor_uri" text NOT NULL,
|
|
534
|
+
"remote_actor_id" uuid,
|
|
535
|
+
"origin_domain" varchar(255) NOT NULL,
|
|
536
|
+
"remote_slug" varchar(128) NOT NULL,
|
|
537
|
+
"name" varchar(256) NOT NULL,
|
|
538
|
+
"description" text,
|
|
539
|
+
"icon_url" text,
|
|
540
|
+
"banner_url" text,
|
|
541
|
+
"hub_type" varchar(32) DEFAULT 'community' NOT NULL,
|
|
542
|
+
"remote_member_count" integer DEFAULT 0 NOT NULL,
|
|
543
|
+
"remote_post_count" integer DEFAULT 0 NOT NULL,
|
|
544
|
+
"local_post_count" integer DEFAULT 0 NOT NULL,
|
|
545
|
+
"status" "follow_relationship_status" DEFAULT 'pending' NOT NULL,
|
|
546
|
+
"follow_activity_uri" text,
|
|
547
|
+
"url" text,
|
|
548
|
+
"rules" text,
|
|
549
|
+
"categories" jsonb,
|
|
550
|
+
"is_hidden" boolean DEFAULT false NOT NULL,
|
|
551
|
+
"last_sync_at" timestamp with time zone,
|
|
552
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
553
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
554
|
+
CONSTRAINT "federated_hubs_actor_uri_unique" UNIQUE("actor_uri")
|
|
555
|
+
);
|
|
556
|
+
--> statement-breakpoint
|
|
557
|
+
CREATE TABLE "follow_relationships" (
|
|
558
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
559
|
+
"follower_actor_uri" text NOT NULL,
|
|
560
|
+
"following_actor_uri" text NOT NULL,
|
|
561
|
+
"activity_uri" text,
|
|
562
|
+
"status" "follow_relationship_status" DEFAULT 'pending' NOT NULL,
|
|
563
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
564
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
565
|
+
CONSTRAINT "follow_relationships_pair" UNIQUE("follower_actor_uri","following_actor_uri")
|
|
566
|
+
);
|
|
567
|
+
--> statement-breakpoint
|
|
568
|
+
CREATE TABLE "instance_health" (
|
|
569
|
+
"domain" varchar(255) PRIMARY KEY NOT NULL,
|
|
570
|
+
"consecutive_failures" integer DEFAULT 0 NOT NULL,
|
|
571
|
+
"total_delivered" integer DEFAULT 0 NOT NULL,
|
|
572
|
+
"total_failed" integer DEFAULT 0 NOT NULL,
|
|
573
|
+
"circuit_open_until" timestamp with time zone,
|
|
574
|
+
"last_success_at" timestamp with time zone,
|
|
575
|
+
"last_failure_at" timestamp with time zone,
|
|
576
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
577
|
+
);
|
|
578
|
+
--> statement-breakpoint
|
|
579
|
+
CREATE TABLE "instance_mirrors" (
|
|
580
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
581
|
+
"remote_domain" varchar(255) NOT NULL,
|
|
582
|
+
"remote_actor_uri" text NOT NULL,
|
|
583
|
+
"status" "mirror_status" DEFAULT 'pending' NOT NULL,
|
|
584
|
+
"direction" "mirror_direction" NOT NULL,
|
|
585
|
+
"filter_content_types" jsonb,
|
|
586
|
+
"filter_tags" jsonb,
|
|
587
|
+
"content_count" integer DEFAULT 0 NOT NULL,
|
|
588
|
+
"error_count" integer DEFAULT 0 NOT NULL,
|
|
589
|
+
"last_error" text,
|
|
590
|
+
"last_sync_at" timestamp with time zone,
|
|
591
|
+
"paused_at" timestamp with time zone,
|
|
592
|
+
"backfill_cursor" text,
|
|
593
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
594
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
595
|
+
CONSTRAINT "instance_mirrors_remote_domain_unique" UNIQUE("remote_domain")
|
|
596
|
+
);
|
|
597
|
+
--> statement-breakpoint
|
|
598
|
+
CREATE TABLE "remote_actors" (
|
|
599
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
600
|
+
"actor_uri" text NOT NULL,
|
|
601
|
+
"inbox" text NOT NULL,
|
|
602
|
+
"outbox" text,
|
|
603
|
+
"shared_inbox" text,
|
|
604
|
+
"public_key_pem" text,
|
|
605
|
+
"preferred_username" varchar(64),
|
|
606
|
+
"display_name" varchar(128),
|
|
607
|
+
"summary" text,
|
|
608
|
+
"avatar_url" text,
|
|
609
|
+
"banner_url" text,
|
|
610
|
+
"actor_type" varchar(32) DEFAULT 'Person' NOT NULL,
|
|
611
|
+
"instance_domain" varchar(255) NOT NULL,
|
|
612
|
+
"follower_count" integer,
|
|
613
|
+
"following_count" integer,
|
|
614
|
+
"last_fetched_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
615
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
616
|
+
CONSTRAINT "remote_actors_actor_uri_unique" UNIQUE("actor_uri")
|
|
617
|
+
);
|
|
618
|
+
--> statement-breakpoint
|
|
619
|
+
CREATE TABLE "user_federated_hub_follows" (
|
|
620
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
621
|
+
"user_id" uuid NOT NULL,
|
|
622
|
+
"federated_hub_id" uuid NOT NULL,
|
|
623
|
+
"status" "hub_follow_status" DEFAULT 'pending' NOT NULL,
|
|
624
|
+
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
625
|
+
CONSTRAINT "uq_user_fed_hub_follow" UNIQUE("user_id","federated_hub_id")
|
|
626
|
+
);
|
|
627
|
+
--> statement-breakpoint
|
|
628
|
+
CREATE TABLE "files" (
|
|
629
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
630
|
+
"uploader_id" uuid NOT NULL,
|
|
631
|
+
"filename" varchar(255) NOT NULL,
|
|
632
|
+
"original_name" varchar(255),
|
|
633
|
+
"mime_type" varchar(128) NOT NULL,
|
|
634
|
+
"size_bytes" integer NOT NULL,
|
|
635
|
+
"storage_key" text NOT NULL,
|
|
636
|
+
"public_url" text,
|
|
637
|
+
"purpose" "file_purpose" DEFAULT 'attachment' NOT NULL,
|
|
638
|
+
"content_id" uuid,
|
|
639
|
+
"hub_id" uuid,
|
|
640
|
+
"width" integer,
|
|
641
|
+
"height" integer,
|
|
642
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
643
|
+
);
|
|
644
|
+
--> statement-breakpoint
|
|
645
|
+
CREATE TABLE "hub_actor_keypairs" (
|
|
646
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
647
|
+
"hub_id" uuid NOT NULL,
|
|
648
|
+
"public_key_pem" text NOT NULL,
|
|
649
|
+
"private_key_pem" text NOT NULL,
|
|
650
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
651
|
+
CONSTRAINT "hub_actor_keypairs_hub_id_unique" UNIQUE("hub_id")
|
|
652
|
+
);
|
|
653
|
+
--> statement-breakpoint
|
|
654
|
+
CREATE TABLE "hub_bans" (
|
|
655
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
656
|
+
"hub_id" uuid NOT NULL,
|
|
657
|
+
"user_id" uuid NOT NULL,
|
|
658
|
+
"banned_by_id" uuid NOT NULL,
|
|
659
|
+
"reason" text,
|
|
660
|
+
"expires_at" timestamp with time zone,
|
|
661
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
662
|
+
);
|
|
663
|
+
--> statement-breakpoint
|
|
664
|
+
CREATE TABLE "hub_followers_fed" (
|
|
665
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
666
|
+
"hub_id" uuid NOT NULL,
|
|
667
|
+
"follower_actor_uri" text NOT NULL,
|
|
668
|
+
"activity_uri" text,
|
|
669
|
+
"status" "follow_relationship_status" DEFAULT 'pending' NOT NULL,
|
|
670
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
671
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
672
|
+
CONSTRAINT "hub_followers_fed_pair" UNIQUE("hub_id","follower_actor_uri")
|
|
673
|
+
);
|
|
674
|
+
--> statement-breakpoint
|
|
675
|
+
CREATE TABLE "hub_invites" (
|
|
676
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
677
|
+
"hub_id" uuid NOT NULL,
|
|
678
|
+
"created_by_id" uuid NOT NULL,
|
|
679
|
+
"token" varchar(64) NOT NULL,
|
|
680
|
+
"max_uses" integer,
|
|
681
|
+
"use_count" integer DEFAULT 0 NOT NULL,
|
|
682
|
+
"expires_at" timestamp with time zone,
|
|
683
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
684
|
+
CONSTRAINT "hub_invites_token_unique" UNIQUE("token")
|
|
685
|
+
);
|
|
686
|
+
--> statement-breakpoint
|
|
687
|
+
CREATE TABLE "hub_members" (
|
|
688
|
+
"hub_id" uuid NOT NULL,
|
|
689
|
+
"user_id" uuid NOT NULL,
|
|
690
|
+
"role" "hub_role" DEFAULT 'member' NOT NULL,
|
|
691
|
+
"status" "hub_member_status" DEFAULT 'active' NOT NULL,
|
|
692
|
+
"joined_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
693
|
+
CONSTRAINT "hub_members_hub_id_user_id_pk" PRIMARY KEY("hub_id","user_id")
|
|
694
|
+
);
|
|
695
|
+
--> statement-breakpoint
|
|
696
|
+
CREATE TABLE "hub_post_likes" (
|
|
697
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
698
|
+
"post_id" uuid NOT NULL,
|
|
699
|
+
"user_id" uuid NOT NULL,
|
|
700
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
701
|
+
CONSTRAINT "uq_hub_post_likes_post_user" UNIQUE("post_id","user_id")
|
|
702
|
+
);
|
|
703
|
+
--> statement-breakpoint
|
|
704
|
+
CREATE TABLE "hub_post_replies" (
|
|
705
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
706
|
+
"post_id" uuid NOT NULL,
|
|
707
|
+
"author_id" uuid,
|
|
708
|
+
"parent_id" uuid,
|
|
709
|
+
"content" text NOT NULL,
|
|
710
|
+
"like_count" integer DEFAULT 0 NOT NULL,
|
|
711
|
+
"remote_actor_uri" text,
|
|
712
|
+
"remote_actor_name" text,
|
|
713
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
714
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
715
|
+
);
|
|
716
|
+
--> statement-breakpoint
|
|
717
|
+
CREATE TABLE "hub_posts" (
|
|
718
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
719
|
+
"hub_id" uuid NOT NULL,
|
|
720
|
+
"author_id" uuid,
|
|
721
|
+
"type" "post_type" DEFAULT 'text' NOT NULL,
|
|
722
|
+
"content" text NOT NULL,
|
|
723
|
+
"is_pinned" boolean DEFAULT false NOT NULL,
|
|
724
|
+
"is_locked" boolean DEFAULT false NOT NULL,
|
|
725
|
+
"like_count" integer DEFAULT 0 NOT NULL,
|
|
726
|
+
"vote_score" integer DEFAULT 0 NOT NULL,
|
|
727
|
+
"reply_count" integer DEFAULT 0 NOT NULL,
|
|
728
|
+
"remote_actor_uri" text,
|
|
729
|
+
"remote_actor_name" text,
|
|
730
|
+
"last_edited_at" timestamp with time zone,
|
|
731
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
732
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
733
|
+
);
|
|
734
|
+
--> statement-breakpoint
|
|
735
|
+
CREATE TABLE "hub_resources" (
|
|
736
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
737
|
+
"hub_id" uuid NOT NULL,
|
|
738
|
+
"title" varchar(255) NOT NULL,
|
|
739
|
+
"url" text NOT NULL,
|
|
740
|
+
"description" text,
|
|
741
|
+
"category" "resource_category" DEFAULT 'other' NOT NULL,
|
|
742
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
743
|
+
"added_by_id" uuid NOT NULL,
|
|
744
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
745
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
746
|
+
);
|
|
747
|
+
--> statement-breakpoint
|
|
748
|
+
CREATE TABLE "hub_shares" (
|
|
749
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
750
|
+
"hub_id" uuid NOT NULL,
|
|
751
|
+
"content_id" uuid NOT NULL,
|
|
752
|
+
"shared_by_id" uuid NOT NULL,
|
|
753
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
754
|
+
CONSTRAINT "uq_hub_shares_hub_content" UNIQUE("hub_id","content_id")
|
|
755
|
+
);
|
|
756
|
+
--> statement-breakpoint
|
|
757
|
+
CREATE TABLE "hubs" (
|
|
758
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
759
|
+
"name" varchar(128) NOT NULL,
|
|
760
|
+
"slug" varchar(128) NOT NULL,
|
|
761
|
+
"description" text,
|
|
762
|
+
"rules" text,
|
|
763
|
+
"icon_url" text,
|
|
764
|
+
"banner_url" text,
|
|
765
|
+
"hub_type" "hub_type" DEFAULT 'community' NOT NULL,
|
|
766
|
+
"privacy" "hub_privacy" DEFAULT 'public' NOT NULL,
|
|
767
|
+
"join_policy" "hub_join_policy" DEFAULT 'open' NOT NULL,
|
|
768
|
+
"parent_hub_id" uuid,
|
|
769
|
+
"website" varchar(512),
|
|
770
|
+
"categories" jsonb,
|
|
771
|
+
"created_by_id" uuid NOT NULL,
|
|
772
|
+
"is_official" boolean DEFAULT false NOT NULL,
|
|
773
|
+
"member_count" integer DEFAULT 0 NOT NULL,
|
|
774
|
+
"post_count" integer DEFAULT 0 NOT NULL,
|
|
775
|
+
"ap_actor_id" text,
|
|
776
|
+
"deleted_at" timestamp with time zone,
|
|
777
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
778
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
779
|
+
CONSTRAINT "hubs_slug_unique" UNIQUE("slug")
|
|
780
|
+
);
|
|
781
|
+
--> statement-breakpoint
|
|
782
|
+
CREATE TABLE "bookmarks" (
|
|
783
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
784
|
+
"user_id" uuid NOT NULL,
|
|
785
|
+
"target_type" "bookmark_target_type" NOT NULL,
|
|
786
|
+
"target_id" uuid NOT NULL,
|
|
787
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
788
|
+
CONSTRAINT "bookmarks_user_target" UNIQUE("user_id","target_type","target_id")
|
|
789
|
+
);
|
|
790
|
+
--> statement-breakpoint
|
|
791
|
+
CREATE TABLE "comments" (
|
|
792
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
793
|
+
"author_id" uuid NOT NULL,
|
|
794
|
+
"target_type" "comment_target_type" NOT NULL,
|
|
795
|
+
"target_id" uuid NOT NULL,
|
|
796
|
+
"parent_id" uuid,
|
|
797
|
+
"content" text NOT NULL,
|
|
798
|
+
"like_count" integer DEFAULT 0 NOT NULL,
|
|
799
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
800
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
801
|
+
);
|
|
802
|
+
--> statement-breakpoint
|
|
803
|
+
CREATE TABLE "conversations" (
|
|
804
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
805
|
+
"participants" jsonb NOT NULL,
|
|
806
|
+
"last_message_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
807
|
+
"last_message" text,
|
|
808
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
809
|
+
);
|
|
810
|
+
--> statement-breakpoint
|
|
811
|
+
CREATE TABLE "follows" (
|
|
812
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
813
|
+
"follower_id" uuid NOT NULL,
|
|
814
|
+
"following_id" uuid NOT NULL,
|
|
815
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
816
|
+
CONSTRAINT "follows_pair" UNIQUE("follower_id","following_id")
|
|
817
|
+
);
|
|
818
|
+
--> statement-breakpoint
|
|
819
|
+
CREATE TABLE "likes" (
|
|
820
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
821
|
+
"user_id" uuid NOT NULL,
|
|
822
|
+
"target_type" "like_target_type" NOT NULL,
|
|
823
|
+
"target_id" uuid NOT NULL,
|
|
824
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
825
|
+
CONSTRAINT "likes_user_target" UNIQUE("user_id","target_type","target_id")
|
|
826
|
+
);
|
|
827
|
+
--> statement-breakpoint
|
|
828
|
+
CREATE TABLE "message_reads" (
|
|
829
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
830
|
+
"message_id" uuid NOT NULL,
|
|
831
|
+
"user_id" uuid NOT NULL,
|
|
832
|
+
"read_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
833
|
+
CONSTRAINT "uq_message_reads" UNIQUE("message_id","user_id")
|
|
834
|
+
);
|
|
835
|
+
--> statement-breakpoint
|
|
836
|
+
CREATE TABLE "messages" (
|
|
837
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
838
|
+
"conversation_id" uuid NOT NULL,
|
|
839
|
+
"sender_id" uuid NOT NULL,
|
|
840
|
+
"body" text NOT NULL,
|
|
841
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
842
|
+
);
|
|
843
|
+
--> statement-breakpoint
|
|
844
|
+
CREATE TABLE "notifications" (
|
|
845
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
846
|
+
"user_id" uuid NOT NULL,
|
|
847
|
+
"type" "notification_type" NOT NULL,
|
|
848
|
+
"title" varchar(255) NOT NULL,
|
|
849
|
+
"message" text NOT NULL,
|
|
850
|
+
"link" varchar(512),
|
|
851
|
+
"actor_id" uuid,
|
|
852
|
+
"read" boolean DEFAULT false NOT NULL,
|
|
853
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
854
|
+
);
|
|
855
|
+
--> statement-breakpoint
|
|
856
|
+
CREATE TABLE "reports" (
|
|
857
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
858
|
+
"reporter_id" uuid NOT NULL,
|
|
859
|
+
"target_type" "report_target_type" NOT NULL,
|
|
860
|
+
"target_id" uuid NOT NULL,
|
|
861
|
+
"reason" "report_reason" NOT NULL,
|
|
862
|
+
"description" text,
|
|
863
|
+
"status" "report_status" DEFAULT 'pending' NOT NULL,
|
|
864
|
+
"reviewed_by_id" uuid,
|
|
865
|
+
"reviewed_at" timestamp with time zone,
|
|
866
|
+
"resolution" text,
|
|
867
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
868
|
+
);
|
|
869
|
+
--> statement-breakpoint
|
|
870
|
+
CREATE TABLE "content_products" (
|
|
871
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
872
|
+
"content_id" uuid NOT NULL,
|
|
873
|
+
"product_id" uuid NOT NULL,
|
|
874
|
+
"quantity" integer DEFAULT 1 NOT NULL,
|
|
875
|
+
"role" varchar(64),
|
|
876
|
+
"notes" text,
|
|
877
|
+
"required" boolean DEFAULT true NOT NULL,
|
|
878
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
879
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
880
|
+
);
|
|
881
|
+
--> statement-breakpoint
|
|
882
|
+
CREATE TABLE "products" (
|
|
883
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
884
|
+
"name" varchar(255) NOT NULL,
|
|
885
|
+
"slug" varchar(255) NOT NULL,
|
|
886
|
+
"description" text,
|
|
887
|
+
"hub_id" uuid NOT NULL,
|
|
888
|
+
"category" "product_category",
|
|
889
|
+
"specs" jsonb,
|
|
890
|
+
"image_url" text,
|
|
891
|
+
"purchase_url" text,
|
|
892
|
+
"datasheet_url" text,
|
|
893
|
+
"alternatives" jsonb,
|
|
894
|
+
"pricing" jsonb,
|
|
895
|
+
"status" "product_status" DEFAULT 'active' NOT NULL,
|
|
896
|
+
"created_by_id" uuid NOT NULL,
|
|
897
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
898
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
899
|
+
CONSTRAINT "products_slug_unique" UNIQUE("slug")
|
|
900
|
+
);
|
|
901
|
+
--> statement-breakpoint
|
|
902
|
+
CREATE TABLE "certificates" (
|
|
903
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
904
|
+
"user_id" uuid NOT NULL,
|
|
905
|
+
"path_id" uuid NOT NULL,
|
|
906
|
+
"verification_code" varchar(64) NOT NULL,
|
|
907
|
+
"certificate_url" text,
|
|
908
|
+
"issued_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
909
|
+
CONSTRAINT "certificates_verification_code_unique" UNIQUE("verification_code"),
|
|
910
|
+
CONSTRAINT "certificates_user_path" UNIQUE("user_id","path_id")
|
|
911
|
+
);
|
|
912
|
+
--> statement-breakpoint
|
|
913
|
+
CREATE TABLE "enrollments" (
|
|
914
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
915
|
+
"user_id" uuid NOT NULL,
|
|
916
|
+
"path_id" uuid NOT NULL,
|
|
917
|
+
"progress" numeric(5, 2) DEFAULT '0' NOT NULL,
|
|
918
|
+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
919
|
+
"completed_at" timestamp with time zone,
|
|
920
|
+
CONSTRAINT "enrollments_user_path" UNIQUE("user_id","path_id")
|
|
921
|
+
);
|
|
922
|
+
--> statement-breakpoint
|
|
923
|
+
CREATE TABLE "learning_lessons" (
|
|
924
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
925
|
+
"module_id" uuid NOT NULL,
|
|
926
|
+
"title" varchar(255) NOT NULL,
|
|
927
|
+
"slug" varchar(255) NOT NULL,
|
|
928
|
+
"type" "lesson_type" NOT NULL,
|
|
929
|
+
"content" jsonb,
|
|
930
|
+
"content_item_id" uuid,
|
|
931
|
+
"duration_minutes" integer,
|
|
932
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
933
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
934
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
935
|
+
CONSTRAINT "learning_lessons_module_slug" UNIQUE("module_id","slug")
|
|
936
|
+
);
|
|
937
|
+
--> statement-breakpoint
|
|
938
|
+
CREATE TABLE "learning_modules" (
|
|
939
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
940
|
+
"path_id" uuid NOT NULL,
|
|
941
|
+
"title" varchar(255) NOT NULL,
|
|
942
|
+
"description" text,
|
|
943
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
944
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
945
|
+
);
|
|
946
|
+
--> statement-breakpoint
|
|
947
|
+
CREATE TABLE "learning_paths" (
|
|
948
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
949
|
+
"title" varchar(255) NOT NULL,
|
|
950
|
+
"slug" varchar(255) NOT NULL,
|
|
951
|
+
"description" text,
|
|
952
|
+
"cover_image_url" text,
|
|
953
|
+
"difficulty" "difficulty",
|
|
954
|
+
"estimated_hours" numeric(5, 1),
|
|
955
|
+
"author_id" uuid NOT NULL,
|
|
956
|
+
"status" "content_status" DEFAULT 'draft' NOT NULL,
|
|
957
|
+
"enrollment_count" integer DEFAULT 0 NOT NULL,
|
|
958
|
+
"completion_count" integer DEFAULT 0 NOT NULL,
|
|
959
|
+
"average_rating" numeric(3, 2),
|
|
960
|
+
"review_count" integer DEFAULT 0 NOT NULL,
|
|
961
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
962
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
963
|
+
CONSTRAINT "learning_paths_slug_unique" UNIQUE("slug")
|
|
964
|
+
);
|
|
965
|
+
--> statement-breakpoint
|
|
966
|
+
CREATE TABLE "lesson_progress" (
|
|
967
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
968
|
+
"user_id" uuid NOT NULL,
|
|
969
|
+
"lesson_id" uuid NOT NULL,
|
|
970
|
+
"completed" boolean DEFAULT false NOT NULL,
|
|
971
|
+
"completed_at" timestamp with time zone,
|
|
972
|
+
"quiz_score" numeric(5, 2),
|
|
973
|
+
"quiz_passed" boolean,
|
|
974
|
+
CONSTRAINT "lesson_progress_user_lesson" UNIQUE("user_id","lesson_id")
|
|
975
|
+
);
|
|
976
|
+
--> statement-breakpoint
|
|
977
|
+
CREATE TABLE "video_categories" (
|
|
978
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
979
|
+
"name" varchar(64) NOT NULL,
|
|
980
|
+
"slug" varchar(64) NOT NULL,
|
|
981
|
+
"description" text,
|
|
982
|
+
"sort_order" integer DEFAULT 0 NOT NULL,
|
|
983
|
+
CONSTRAINT "video_categories_name_unique" UNIQUE("name"),
|
|
984
|
+
CONSTRAINT "video_categories_slug_unique" UNIQUE("slug")
|
|
985
|
+
);
|
|
986
|
+
--> statement-breakpoint
|
|
987
|
+
CREATE TABLE "videos" (
|
|
988
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
989
|
+
"author_id" uuid NOT NULL,
|
|
990
|
+
"title" varchar(255) NOT NULL,
|
|
991
|
+
"description" text,
|
|
992
|
+
"url" text NOT NULL,
|
|
993
|
+
"embed_url" text,
|
|
994
|
+
"platform" "video_platform" NOT NULL,
|
|
995
|
+
"thumbnail_url" text,
|
|
996
|
+
"duration" varchar(16),
|
|
997
|
+
"category_id" uuid,
|
|
998
|
+
"view_count" integer DEFAULT 0 NOT NULL,
|
|
999
|
+
"like_count" integer DEFAULT 0 NOT NULL,
|
|
1000
|
+
"comment_count" integer DEFAULT 0 NOT NULL,
|
|
1001
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
1002
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
1003
|
+
);
|
|
1004
|
+
--> statement-breakpoint
|
|
1005
|
+
CREATE TABLE "contest_entry_votes" (
|
|
1006
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1007
|
+
"entry_id" uuid NOT NULL,
|
|
1008
|
+
"user_id" uuid NOT NULL,
|
|
1009
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
1010
|
+
CONSTRAINT "uq_contest_entry_votes_entry_user" UNIQUE("entry_id","user_id")
|
|
1011
|
+
);
|
|
1012
|
+
--> statement-breakpoint
|
|
1013
|
+
CREATE TABLE "hub_post_votes" (
|
|
1014
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1015
|
+
"post_id" uuid NOT NULL,
|
|
1016
|
+
"user_id" uuid NOT NULL,
|
|
1017
|
+
"direction" "vote_direction" NOT NULL,
|
|
1018
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
1019
|
+
CONSTRAINT "uq_hub_post_votes_post_user" UNIQUE("post_id","user_id")
|
|
1020
|
+
);
|
|
1021
|
+
--> statement-breakpoint
|
|
1022
|
+
CREATE TABLE "poll_options" (
|
|
1023
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1024
|
+
"post_id" uuid NOT NULL,
|
|
1025
|
+
"label" varchar(255) NOT NULL,
|
|
1026
|
+
"vote_count" integer DEFAULT 0 NOT NULL,
|
|
1027
|
+
"order" integer DEFAULT 0 NOT NULL
|
|
1028
|
+
);
|
|
1029
|
+
--> statement-breakpoint
|
|
1030
|
+
CREATE TABLE "poll_votes" (
|
|
1031
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1032
|
+
"option_id" uuid NOT NULL,
|
|
1033
|
+
"user_id" uuid NOT NULL,
|
|
1034
|
+
"post_id" uuid NOT NULL,
|
|
1035
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
1036
|
+
CONSTRAINT "uq_poll_votes_post_user" UNIQUE("post_id","user_id")
|
|
1037
|
+
);
|
|
1038
|
+
--> statement-breakpoint
|
|
1039
|
+
CREATE TABLE "api_key_usage" (
|
|
1040
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1041
|
+
"key_id" uuid NOT NULL,
|
|
1042
|
+
"endpoint" varchar(200) NOT NULL,
|
|
1043
|
+
"method" varchar(10) DEFAULT 'GET' NOT NULL,
|
|
1044
|
+
"status_code" integer NOT NULL,
|
|
1045
|
+
"latency_ms" integer,
|
|
1046
|
+
"timestamp" timestamp with time zone DEFAULT now() NOT NULL
|
|
1047
|
+
);
|
|
1048
|
+
--> statement-breakpoint
|
|
1049
|
+
CREATE TABLE "api_keys" (
|
|
1050
|
+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
1051
|
+
"name" varchar(120) NOT NULL,
|
|
1052
|
+
"prefix" varchar(32) NOT NULL,
|
|
1053
|
+
"key_hash" varchar(64) NOT NULL,
|
|
1054
|
+
"scopes" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
1055
|
+
"description" text,
|
|
1056
|
+
"allowed_origins" jsonb,
|
|
1057
|
+
"rate_limit_per_minute" integer DEFAULT 60 NOT NULL,
|
|
1058
|
+
"created_by" uuid NOT NULL,
|
|
1059
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
1060
|
+
"last_used_at" timestamp with time zone,
|
|
1061
|
+
"expires_at" timestamp with time zone,
|
|
1062
|
+
"revoked_at" timestamp with time zone,
|
|
1063
|
+
"revoked_by" uuid
|
|
1064
|
+
);
|
|
1065
|
+
--> statement-breakpoint
|
|
1066
|
+
ALTER TABLE "audit_logs" ADD CONSTRAINT "audit_logs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1067
|
+
ALTER TABLE "instance_settings" ADD CONSTRAINT "instance_settings_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1068
|
+
ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1069
|
+
ALTER TABLE "federated_accounts" ADD CONSTRAINT "federated_accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1070
|
+
ALTER TABLE "members" ADD CONSTRAINT "members_organization_id_organizations_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organizations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1071
|
+
ALTER TABLE "members" ADD CONSTRAINT "members_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1072
|
+
ALTER TABLE "oauth_codes" ADD CONSTRAINT "oauth_codes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1073
|
+
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
|
|
1074
|
+
ALTER TABLE "content_builds" ADD CONSTRAINT "content_builds_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1075
|
+
ALTER TABLE "content_builds" ADD CONSTRAINT "content_builds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1076
|
+
ALTER TABLE "content_forks" ADD CONSTRAINT "content_forks_source_id_content_items_id_fk" FOREIGN KEY ("source_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1077
|
+
ALTER TABLE "content_forks" ADD CONSTRAINT "content_forks_fork_id_content_items_id_fk" FOREIGN KEY ("fork_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1078
|
+
ALTER TABLE "content_items" ADD CONSTRAINT "content_items_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1079
|
+
ALTER TABLE "content_items" ADD CONSTRAINT "content_items_category_id_content_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."content_categories"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1080
|
+
ALTER TABLE "content_tags" ADD CONSTRAINT "content_tags_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1081
|
+
ALTER TABLE "content_tags" ADD CONSTRAINT "content_tags_tag_id_tags_id_fk" FOREIGN KEY ("tag_id") REFERENCES "public"."tags"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1082
|
+
ALTER TABLE "content_versions" ADD CONSTRAINT "content_versions_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1083
|
+
ALTER TABLE "content_versions" ADD CONSTRAINT "content_versions_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1084
|
+
ALTER TABLE "contest_entries" ADD CONSTRAINT "contest_entries_contest_id_contests_id_fk" FOREIGN KEY ("contest_id") REFERENCES "public"."contests"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1085
|
+
ALTER TABLE "contest_entries" ADD CONSTRAINT "contest_entries_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1086
|
+
ALTER TABLE "contest_entries" ADD CONSTRAINT "contest_entries_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1087
|
+
ALTER TABLE "contest_judges" ADD CONSTRAINT "contest_judges_contest_id_contests_id_fk" FOREIGN KEY ("contest_id") REFERENCES "public"."contests"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1088
|
+
ALTER TABLE "contest_judges" ADD CONSTRAINT "contest_judges_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1089
|
+
ALTER TABLE "contests" ADD CONSTRAINT "contests_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1090
|
+
ALTER TABLE "docs_pages" ADD CONSTRAINT "docs_pages_version_id_docs_versions_id_fk" FOREIGN KEY ("version_id") REFERENCES "public"."docs_versions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1091
|
+
ALTER TABLE "docs_sites" ADD CONSTRAINT "docs_sites_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1092
|
+
ALTER TABLE "docs_versions" ADD CONSTRAINT "docs_versions_site_id_docs_sites_id_fk" FOREIGN KEY ("site_id") REFERENCES "public"."docs_sites"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1093
|
+
ALTER TABLE "event_attendees" ADD CONSTRAINT "event_attendees_event_id_events_id_fk" FOREIGN KEY ("event_id") REFERENCES "public"."events"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1094
|
+
ALTER TABLE "event_attendees" ADD CONSTRAINT "event_attendees_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1095
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1096
|
+
ALTER TABLE "events" ADD CONSTRAINT "events_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1097
|
+
ALTER TABLE "actor_keypairs" ADD CONSTRAINT "actor_keypairs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1098
|
+
ALTER TABLE "federated_content" ADD CONSTRAINT "federated_content_remote_actor_id_remote_actors_id_fk" FOREIGN KEY ("remote_actor_id") REFERENCES "public"."remote_actors"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1099
|
+
ALTER TABLE "federated_content_builds" ADD CONSTRAINT "federated_content_builds_federated_content_id_federated_content_id_fk" FOREIGN KEY ("federated_content_id") REFERENCES "public"."federated_content"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1100
|
+
ALTER TABLE "federated_content_builds" ADD CONSTRAINT "federated_content_builds_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1101
|
+
ALTER TABLE "federated_hub_members" ADD CONSTRAINT "federated_hub_members_federated_hub_id_federated_hubs_id_fk" FOREIGN KEY ("federated_hub_id") REFERENCES "public"."federated_hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1102
|
+
ALTER TABLE "federated_hub_members" ADD CONSTRAINT "federated_hub_members_remote_actor_id_remote_actors_id_fk" FOREIGN KEY ("remote_actor_id") REFERENCES "public"."remote_actors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1103
|
+
ALTER TABLE "federated_hub_post_likes" ADD CONSTRAINT "federated_hub_post_likes_post_id_federated_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."federated_hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1104
|
+
ALTER TABLE "federated_hub_post_likes" ADD CONSTRAINT "federated_hub_post_likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1105
|
+
ALTER TABLE "federated_hub_post_replies" ADD CONSTRAINT "federated_hub_post_replies_federated_hub_post_id_federated_hub_posts_id_fk" FOREIGN KEY ("federated_hub_post_id") REFERENCES "public"."federated_hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1106
|
+
ALTER TABLE "federated_hub_post_replies" ADD CONSTRAINT "federated_hub_post_replies_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1107
|
+
ALTER TABLE "federated_hub_posts" ADD CONSTRAINT "federated_hub_posts_federated_hub_id_federated_hubs_id_fk" FOREIGN KEY ("federated_hub_id") REFERENCES "public"."federated_hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1108
|
+
ALTER TABLE "federated_hub_posts" ADD CONSTRAINT "federated_hub_posts_remote_actor_id_remote_actors_id_fk" FOREIGN KEY ("remote_actor_id") REFERENCES "public"."remote_actors"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1109
|
+
ALTER TABLE "federated_hub_products" ADD CONSTRAINT "federated_hub_products_federated_hub_id_federated_hubs_id_fk" FOREIGN KEY ("federated_hub_id") REFERENCES "public"."federated_hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1110
|
+
ALTER TABLE "federated_hub_resources" ADD CONSTRAINT "federated_hub_resources_federated_hub_id_federated_hubs_id_fk" FOREIGN KEY ("federated_hub_id") REFERENCES "public"."federated_hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1111
|
+
ALTER TABLE "federated_hubs" ADD CONSTRAINT "federated_hubs_remote_actor_id_remote_actors_id_fk" FOREIGN KEY ("remote_actor_id") REFERENCES "public"."remote_actors"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1112
|
+
ALTER TABLE "user_federated_hub_follows" ADD CONSTRAINT "user_federated_hub_follows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1113
|
+
ALTER TABLE "user_federated_hub_follows" ADD CONSTRAINT "user_federated_hub_follows_federated_hub_id_federated_hubs_id_fk" FOREIGN KEY ("federated_hub_id") REFERENCES "public"."federated_hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1114
|
+
ALTER TABLE "files" ADD CONSTRAINT "files_uploader_id_users_id_fk" FOREIGN KEY ("uploader_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1115
|
+
ALTER TABLE "files" ADD CONSTRAINT "files_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1116
|
+
ALTER TABLE "files" ADD CONSTRAINT "files_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1117
|
+
ALTER TABLE "hub_actor_keypairs" ADD CONSTRAINT "hub_actor_keypairs_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1118
|
+
ALTER TABLE "hub_bans" ADD CONSTRAINT "hub_bans_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1119
|
+
ALTER TABLE "hub_bans" ADD CONSTRAINT "hub_bans_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1120
|
+
ALTER TABLE "hub_bans" ADD CONSTRAINT "hub_bans_banned_by_id_users_id_fk" FOREIGN KEY ("banned_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1121
|
+
ALTER TABLE "hub_followers_fed" ADD CONSTRAINT "hub_followers_fed_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1122
|
+
ALTER TABLE "hub_invites" ADD CONSTRAINT "hub_invites_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1123
|
+
ALTER TABLE "hub_invites" ADD CONSTRAINT "hub_invites_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1124
|
+
ALTER TABLE "hub_members" ADD CONSTRAINT "hub_members_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1125
|
+
ALTER TABLE "hub_members" ADD CONSTRAINT "hub_members_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1126
|
+
ALTER TABLE "hub_post_likes" ADD CONSTRAINT "hub_post_likes_post_id_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1127
|
+
ALTER TABLE "hub_post_likes" ADD CONSTRAINT "hub_post_likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1128
|
+
ALTER TABLE "hub_post_replies" ADD CONSTRAINT "hub_post_replies_post_id_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1129
|
+
ALTER TABLE "hub_post_replies" ADD CONSTRAINT "hub_post_replies_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1130
|
+
ALTER TABLE "hub_posts" ADD CONSTRAINT "hub_posts_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1131
|
+
ALTER TABLE "hub_posts" ADD CONSTRAINT "hub_posts_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1132
|
+
ALTER TABLE "hub_resources" ADD CONSTRAINT "hub_resources_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1133
|
+
ALTER TABLE "hub_resources" ADD CONSTRAINT "hub_resources_added_by_id_users_id_fk" FOREIGN KEY ("added_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1134
|
+
ALTER TABLE "hub_shares" ADD CONSTRAINT "hub_shares_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1135
|
+
ALTER TABLE "hub_shares" ADD CONSTRAINT "hub_shares_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1136
|
+
ALTER TABLE "hub_shares" ADD CONSTRAINT "hub_shares_shared_by_id_users_id_fk" FOREIGN KEY ("shared_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1137
|
+
ALTER TABLE "hubs" ADD CONSTRAINT "hubs_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1138
|
+
ALTER TABLE "bookmarks" ADD CONSTRAINT "bookmarks_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1139
|
+
ALTER TABLE "comments" ADD CONSTRAINT "comments_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1140
|
+
ALTER TABLE "follows" ADD CONSTRAINT "follows_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1141
|
+
ALTER TABLE "follows" ADD CONSTRAINT "follows_following_id_users_id_fk" FOREIGN KEY ("following_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1142
|
+
ALTER TABLE "likes" ADD CONSTRAINT "likes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1143
|
+
ALTER TABLE "message_reads" ADD CONSTRAINT "message_reads_message_id_messages_id_fk" FOREIGN KEY ("message_id") REFERENCES "public"."messages"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1144
|
+
ALTER TABLE "message_reads" ADD CONSTRAINT "message_reads_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1145
|
+
ALTER TABLE "messages" ADD CONSTRAINT "messages_conversation_id_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1146
|
+
ALTER TABLE "messages" ADD CONSTRAINT "messages_sender_id_users_id_fk" FOREIGN KEY ("sender_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1147
|
+
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1148
|
+
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_actor_id_users_id_fk" FOREIGN KEY ("actor_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1149
|
+
ALTER TABLE "reports" ADD CONSTRAINT "reports_reporter_id_users_id_fk" FOREIGN KEY ("reporter_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1150
|
+
ALTER TABLE "reports" ADD CONSTRAINT "reports_reviewed_by_id_users_id_fk" FOREIGN KEY ("reviewed_by_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1151
|
+
ALTER TABLE "content_products" ADD CONSTRAINT "content_products_content_id_content_items_id_fk" FOREIGN KEY ("content_id") REFERENCES "public"."content_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1152
|
+
ALTER TABLE "content_products" ADD CONSTRAINT "content_products_product_id_products_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1153
|
+
ALTER TABLE "products" ADD CONSTRAINT "products_hub_id_hubs_id_fk" FOREIGN KEY ("hub_id") REFERENCES "public"."hubs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1154
|
+
ALTER TABLE "products" ADD CONSTRAINT "products_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1155
|
+
ALTER TABLE "certificates" ADD CONSTRAINT "certificates_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1156
|
+
ALTER TABLE "certificates" ADD CONSTRAINT "certificates_path_id_learning_paths_id_fk" FOREIGN KEY ("path_id") REFERENCES "public"."learning_paths"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1157
|
+
ALTER TABLE "enrollments" ADD CONSTRAINT "enrollments_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1158
|
+
ALTER TABLE "enrollments" ADD CONSTRAINT "enrollments_path_id_learning_paths_id_fk" FOREIGN KEY ("path_id") REFERENCES "public"."learning_paths"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1159
|
+
ALTER TABLE "learning_lessons" ADD CONSTRAINT "learning_lessons_module_id_learning_modules_id_fk" FOREIGN KEY ("module_id") REFERENCES "public"."learning_modules"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1160
|
+
ALTER TABLE "learning_lessons" ADD CONSTRAINT "learning_lessons_content_item_id_content_items_id_fk" FOREIGN KEY ("content_item_id") REFERENCES "public"."content_items"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1161
|
+
ALTER TABLE "learning_modules" ADD CONSTRAINT "learning_modules_path_id_learning_paths_id_fk" FOREIGN KEY ("path_id") REFERENCES "public"."learning_paths"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1162
|
+
ALTER TABLE "learning_paths" ADD CONSTRAINT "learning_paths_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1163
|
+
ALTER TABLE "lesson_progress" ADD CONSTRAINT "lesson_progress_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1164
|
+
ALTER TABLE "lesson_progress" ADD CONSTRAINT "lesson_progress_lesson_id_learning_lessons_id_fk" FOREIGN KEY ("lesson_id") REFERENCES "public"."learning_lessons"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1165
|
+
ALTER TABLE "videos" ADD CONSTRAINT "videos_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1166
|
+
ALTER TABLE "videos" ADD CONSTRAINT "videos_category_id_video_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."video_categories"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1167
|
+
ALTER TABLE "contest_entry_votes" ADD CONSTRAINT "contest_entry_votes_entry_id_contest_entries_id_fk" FOREIGN KEY ("entry_id") REFERENCES "public"."contest_entries"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1168
|
+
ALTER TABLE "contest_entry_votes" ADD CONSTRAINT "contest_entry_votes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1169
|
+
ALTER TABLE "hub_post_votes" ADD CONSTRAINT "hub_post_votes_post_id_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1170
|
+
ALTER TABLE "hub_post_votes" ADD CONSTRAINT "hub_post_votes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1171
|
+
ALTER TABLE "poll_options" ADD CONSTRAINT "poll_options_post_id_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1172
|
+
ALTER TABLE "poll_votes" ADD CONSTRAINT "poll_votes_option_id_poll_options_id_fk" FOREIGN KEY ("option_id") REFERENCES "public"."poll_options"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1173
|
+
ALTER TABLE "poll_votes" ADD CONSTRAINT "poll_votes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1174
|
+
ALTER TABLE "poll_votes" ADD CONSTRAINT "poll_votes_post_id_hub_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."hub_posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1175
|
+
ALTER TABLE "api_key_usage" ADD CONSTRAINT "api_key_usage_key_id_api_keys_id_fk" FOREIGN KEY ("key_id") REFERENCES "public"."api_keys"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1176
|
+
ALTER TABLE "api_keys" ADD CONSTRAINT "api_keys_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
1177
|
+
ALTER TABLE "api_keys" ADD CONSTRAINT "api_keys_revoked_by_users_id_fk" FOREIGN KEY ("revoked_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
1178
|
+
CREATE INDEX "idx_audit_logs_user_id" ON "audit_logs" USING btree ("user_id");--> statement-breakpoint
|
|
1179
|
+
CREATE INDEX "idx_audit_logs_created_at" ON "audit_logs" USING btree ("created_at");--> statement-breakpoint
|
|
1180
|
+
CREATE INDEX "idx_content_builds_content_id" ON "content_builds" USING btree ("content_id");--> statement-breakpoint
|
|
1181
|
+
CREATE INDEX "idx_content_forks_source_id" ON "content_forks" USING btree ("source_id");--> statement-breakpoint
|
|
1182
|
+
CREATE INDEX "idx_content_forks_fork_id" ON "content_forks" USING btree ("fork_id");--> statement-breakpoint
|
|
1183
|
+
CREATE INDEX "idx_content_items_author_id" ON "content_items" USING btree ("author_id");--> statement-breakpoint
|
|
1184
|
+
CREATE INDEX "idx_content_items_status" ON "content_items" USING btree ("status");--> statement-breakpoint
|
|
1185
|
+
CREATE INDEX "idx_content_items_type" ON "content_items" USING btree ("type");--> statement-breakpoint
|
|
1186
|
+
CREATE INDEX "idx_content_items_published_at" ON "content_items" USING btree ("published_at");--> statement-breakpoint
|
|
1187
|
+
CREATE INDEX "idx_content_items_is_editorial" ON "content_items" USING btree ("is_editorial");--> statement-breakpoint
|
|
1188
|
+
CREATE INDEX "idx_content_items_category_id" ON "content_items" USING btree ("category_id");--> statement-breakpoint
|
|
1189
|
+
CREATE INDEX "idx_content_tags_content_id" ON "content_tags" USING btree ("content_id");--> statement-breakpoint
|
|
1190
|
+
CREATE INDEX "idx_content_tags_tag_id" ON "content_tags" USING btree ("tag_id");--> statement-breakpoint
|
|
1191
|
+
CREATE INDEX "idx_content_versions_content_id" ON "content_versions" USING btree ("content_id");--> statement-breakpoint
|
|
1192
|
+
CREATE INDEX "idx_contest_entries_contest_id" ON "contest_entries" USING btree ("contest_id");--> statement-breakpoint
|
|
1193
|
+
CREATE INDEX "idx_contest_entries_user_id" ON "contest_entries" USING btree ("user_id");--> statement-breakpoint
|
|
1194
|
+
CREATE INDEX "idx_contest_judges_contest_id" ON "contest_judges" USING btree ("contest_id");--> statement-breakpoint
|
|
1195
|
+
CREATE INDEX "idx_contest_judges_user_id" ON "contest_judges" USING btree ("user_id");--> statement-breakpoint
|
|
1196
|
+
CREATE INDEX "idx_contests_created_by_id" ON "contests" USING btree ("created_by_id");--> statement-breakpoint
|
|
1197
|
+
CREATE INDEX "idx_contests_status" ON "contests" USING btree ("status");--> statement-breakpoint
|
|
1198
|
+
CREATE INDEX "idx_docs_pages_version_id" ON "docs_pages" USING btree ("version_id");--> statement-breakpoint
|
|
1199
|
+
CREATE INDEX "idx_docs_pages_parent_id" ON "docs_pages" USING btree ("parent_id");--> statement-breakpoint
|
|
1200
|
+
CREATE INDEX "idx_docs_sites_owner_id" ON "docs_sites" USING btree ("owner_id");--> statement-breakpoint
|
|
1201
|
+
CREATE INDEX "idx_docs_versions_site_id" ON "docs_versions" USING btree ("site_id");--> statement-breakpoint
|
|
1202
|
+
CREATE INDEX "idx_event_attendees_event_id" ON "event_attendees" USING btree ("event_id");--> statement-breakpoint
|
|
1203
|
+
CREATE INDEX "idx_event_attendees_user_id" ON "event_attendees" USING btree ("user_id");--> statement-breakpoint
|
|
1204
|
+
CREATE INDEX "idx_events_created_by_id" ON "events" USING btree ("created_by_id");--> statement-breakpoint
|
|
1205
|
+
CREATE INDEX "idx_events_status" ON "events" USING btree ("status");--> statement-breakpoint
|
|
1206
|
+
CREATE INDEX "idx_events_start_date" ON "events" USING btree ("start_date");--> statement-breakpoint
|
|
1207
|
+
CREATE INDEX "idx_events_hub_id" ON "events" USING btree ("hub_id");--> statement-breakpoint
|
|
1208
|
+
CREATE INDEX "idx_activities_direction_status" ON "activities" USING btree ("direction","status");--> statement-breakpoint
|
|
1209
|
+
CREATE INDEX "idx_activities_actor_uri" ON "activities" USING btree ("actor_uri");--> statement-breakpoint
|
|
1210
|
+
CREATE INDEX "idx_activities_created_at" ON "activities" USING btree ("created_at");--> statement-breakpoint
|
|
1211
|
+
CREATE INDEX "idx_fedcontent_actor_uri" ON "federated_content" USING btree ("actor_uri");--> statement-breakpoint
|
|
1212
|
+
CREATE INDEX "idx_fedcontent_origin_domain" ON "federated_content" USING btree ("origin_domain");--> statement-breakpoint
|
|
1213
|
+
CREATE INDEX "idx_fedcontent_received_at" ON "federated_content" USING btree ("received_at");--> statement-breakpoint
|
|
1214
|
+
CREATE INDEX "idx_fedcontent_ap_type" ON "federated_content" USING btree ("ap_type");--> statement-breakpoint
|
|
1215
|
+
CREATE INDEX "idx_fedcontent_cpub_type" ON "federated_content" USING btree ("cpub_type");--> statement-breakpoint
|
|
1216
|
+
CREATE INDEX "idx_fedcontent_mirror_id" ON "federated_content" USING btree ("mirror_id");--> statement-breakpoint
|
|
1217
|
+
CREATE INDEX "idx_fedcontent_object_uri" ON "federated_content" USING btree ("object_uri");--> statement-breakpoint
|
|
1218
|
+
CREATE INDEX "idx_fed_content_builds_content_id" ON "federated_content_builds" USING btree ("federated_content_id");--> statement-breakpoint
|
|
1219
|
+
CREATE INDEX "idx_fed_hub_members_hub" ON "federated_hub_members" USING btree ("federated_hub_id");--> statement-breakpoint
|
|
1220
|
+
CREATE INDEX "idx_fed_hub_post_replies_post" ON "federated_hub_post_replies" USING btree ("federated_hub_post_id");--> statement-breakpoint
|
|
1221
|
+
CREATE INDEX "idx_fed_hub_post_replies_author" ON "federated_hub_post_replies" USING btree ("author_id");--> statement-breakpoint
|
|
1222
|
+
CREATE INDEX "idx_fedhubposts_hub_id" ON "federated_hub_posts" USING btree ("federated_hub_id");--> statement-breakpoint
|
|
1223
|
+
CREATE INDEX "idx_fedhubposts_received_at" ON "federated_hub_posts" USING btree ("received_at");--> statement-breakpoint
|
|
1224
|
+
CREATE INDEX "idx_fed_hub_products_hub" ON "federated_hub_products" USING btree ("federated_hub_id");--> statement-breakpoint
|
|
1225
|
+
CREATE INDEX "idx_fed_hub_resources_hub" ON "federated_hub_resources" USING btree ("federated_hub_id");--> statement-breakpoint
|
|
1226
|
+
CREATE INDEX "idx_fedhubs_origin_domain" ON "federated_hubs" USING btree ("origin_domain");--> statement-breakpoint
|
|
1227
|
+
CREATE INDEX "idx_fedhubs_status_hidden" ON "federated_hubs" USING btree ("status","is_hidden");--> statement-breakpoint
|
|
1228
|
+
CREATE INDEX "idx_fedhubs_name" ON "federated_hubs" USING btree ("name");--> statement-breakpoint
|
|
1229
|
+
CREATE INDEX "idx_fedhubs_remote_actor_id" ON "federated_hubs" USING btree ("remote_actor_id");--> statement-breakpoint
|
|
1230
|
+
CREATE INDEX "idx_user_fed_hub_follow_user" ON "user_federated_hub_follows" USING btree ("user_id");--> statement-breakpoint
|
|
1231
|
+
CREATE INDEX "idx_user_fed_hub_follow_hub" ON "user_federated_hub_follows" USING btree ("federated_hub_id");--> statement-breakpoint
|
|
1232
|
+
CREATE INDEX "idx_files_uploader_id" ON "files" USING btree ("uploader_id");--> statement-breakpoint
|
|
1233
|
+
CREATE INDEX "idx_files_content_id" ON "files" USING btree ("content_id");--> statement-breakpoint
|
|
1234
|
+
CREATE INDEX "idx_files_hub_id" ON "files" USING btree ("hub_id");--> statement-breakpoint
|
|
1235
|
+
CREATE INDEX "idx_hub_bans_hub_id" ON "hub_bans" USING btree ("hub_id");--> statement-breakpoint
|
|
1236
|
+
CREATE INDEX "idx_hub_bans_user_id" ON "hub_bans" USING btree ("user_id");--> statement-breakpoint
|
|
1237
|
+
CREATE INDEX "idx_hub_followers_fed_hub" ON "hub_followers_fed" USING btree ("hub_id");--> statement-breakpoint
|
|
1238
|
+
CREATE INDEX "idx_hub_invites_hub_id" ON "hub_invites" USING btree ("hub_id");--> statement-breakpoint
|
|
1239
|
+
CREATE INDEX "idx_hub_post_likes_post_id" ON "hub_post_likes" USING btree ("post_id");--> statement-breakpoint
|
|
1240
|
+
CREATE INDEX "idx_hub_post_likes_user_id" ON "hub_post_likes" USING btree ("user_id");--> statement-breakpoint
|
|
1241
|
+
CREATE INDEX "idx_hub_post_replies_post_id" ON "hub_post_replies" USING btree ("post_id");--> statement-breakpoint
|
|
1242
|
+
CREATE INDEX "idx_hub_post_replies_author_id" ON "hub_post_replies" USING btree ("author_id");--> statement-breakpoint
|
|
1243
|
+
CREATE INDEX "idx_hub_posts_hub_id" ON "hub_posts" USING btree ("hub_id");--> statement-breakpoint
|
|
1244
|
+
CREATE INDEX "idx_hub_posts_author_id" ON "hub_posts" USING btree ("author_id");--> statement-breakpoint
|
|
1245
|
+
CREATE INDEX "idx_hub_resources_hub_id" ON "hub_resources" USING btree ("hub_id");--> statement-breakpoint
|
|
1246
|
+
CREATE INDEX "idx_hub_resources_added_by_id" ON "hub_resources" USING btree ("added_by_id");--> statement-breakpoint
|
|
1247
|
+
CREATE INDEX "idx_hub_shares_hub_id" ON "hub_shares" USING btree ("hub_id");--> statement-breakpoint
|
|
1248
|
+
CREATE INDEX "idx_hub_shares_content_id" ON "hub_shares" USING btree ("content_id");--> statement-breakpoint
|
|
1249
|
+
CREATE INDEX "idx_hubs_created_by_id" ON "hubs" USING btree ("created_by_id");--> statement-breakpoint
|
|
1250
|
+
CREATE INDEX "idx_hubs_hub_type" ON "hubs" USING btree ("hub_type");--> statement-breakpoint
|
|
1251
|
+
CREATE INDEX "idx_bookmarks_target" ON "bookmarks" USING btree ("target_type","target_id");--> statement-breakpoint
|
|
1252
|
+
CREATE INDEX "idx_bookmarks_user_id" ON "bookmarks" USING btree ("user_id");--> statement-breakpoint
|
|
1253
|
+
CREATE INDEX "idx_comments_author_id" ON "comments" USING btree ("author_id");--> statement-breakpoint
|
|
1254
|
+
CREATE INDEX "idx_comments_target" ON "comments" USING btree ("target_type","target_id");--> statement-breakpoint
|
|
1255
|
+
CREATE INDEX "idx_comments_parent_id" ON "comments" USING btree ("parent_id");--> statement-breakpoint
|
|
1256
|
+
CREATE INDEX "idx_conversations_participants_gin" ON "conversations" USING gin ("participants");--> statement-breakpoint
|
|
1257
|
+
CREATE INDEX "idx_follows_follower_id" ON "follows" USING btree ("follower_id");--> statement-breakpoint
|
|
1258
|
+
CREATE INDEX "idx_follows_following_id" ON "follows" USING btree ("following_id");--> statement-breakpoint
|
|
1259
|
+
CREATE INDEX "idx_likes_target" ON "likes" USING btree ("target_type","target_id");--> statement-breakpoint
|
|
1260
|
+
CREATE INDEX "idx_message_reads_user_id" ON "message_reads" USING btree ("user_id");--> statement-breakpoint
|
|
1261
|
+
CREATE INDEX "idx_messages_conversation_id" ON "messages" USING btree ("conversation_id");--> statement-breakpoint
|
|
1262
|
+
CREATE INDEX "idx_messages_sender_id" ON "messages" USING btree ("sender_id");--> statement-breakpoint
|
|
1263
|
+
CREATE INDEX "idx_notifications_user_id" ON "notifications" USING btree ("user_id");--> statement-breakpoint
|
|
1264
|
+
CREATE INDEX "idx_notifications_user_read" ON "notifications" USING btree ("user_id","read");--> statement-breakpoint
|
|
1265
|
+
CREATE INDEX "idx_reports_reporter_id" ON "reports" USING btree ("reporter_id");--> statement-breakpoint
|
|
1266
|
+
CREATE INDEX "idx_reports_status" ON "reports" USING btree ("status");--> statement-breakpoint
|
|
1267
|
+
CREATE UNIQUE INDEX "idx_content_product_unique" ON "content_products" USING btree ("content_id","product_id");--> statement-breakpoint
|
|
1268
|
+
CREATE INDEX "idx_content_products_product_id" ON "content_products" USING btree ("product_id");--> statement-breakpoint
|
|
1269
|
+
CREATE INDEX "idx_products_hub_id" ON "products" USING btree ("hub_id");--> statement-breakpoint
|
|
1270
|
+
CREATE INDEX "idx_products_created_by_id" ON "products" USING btree ("created_by_id");--> statement-breakpoint
|
|
1271
|
+
CREATE INDEX "idx_certificates_path_id" ON "certificates" USING btree ("path_id");--> statement-breakpoint
|
|
1272
|
+
CREATE INDEX "idx_enrollments_user_id" ON "enrollments" USING btree ("user_id");--> statement-breakpoint
|
|
1273
|
+
CREATE INDEX "idx_enrollments_path_id" ON "enrollments" USING btree ("path_id");--> statement-breakpoint
|
|
1274
|
+
CREATE INDEX "idx_learning_lessons_module_id" ON "learning_lessons" USING btree ("module_id");--> statement-breakpoint
|
|
1275
|
+
CREATE INDEX "idx_learning_modules_path_id" ON "learning_modules" USING btree ("path_id");--> statement-breakpoint
|
|
1276
|
+
CREATE INDEX "idx_learning_paths_author_id" ON "learning_paths" USING btree ("author_id");--> statement-breakpoint
|
|
1277
|
+
CREATE INDEX "idx_learning_paths_status" ON "learning_paths" USING btree ("status");--> statement-breakpoint
|
|
1278
|
+
CREATE INDEX "idx_lesson_progress_lesson_id" ON "lesson_progress" USING btree ("lesson_id");--> statement-breakpoint
|
|
1279
|
+
CREATE INDEX "idx_lesson_progress_user_id" ON "lesson_progress" USING btree ("user_id");--> statement-breakpoint
|
|
1280
|
+
CREATE INDEX "idx_videos_author_id" ON "videos" USING btree ("author_id");--> statement-breakpoint
|
|
1281
|
+
CREATE INDEX "idx_videos_category_id" ON "videos" USING btree ("category_id");--> statement-breakpoint
|
|
1282
|
+
CREATE INDEX "idx_contest_entry_votes_entry_id" ON "contest_entry_votes" USING btree ("entry_id");--> statement-breakpoint
|
|
1283
|
+
CREATE INDEX "idx_contest_entry_votes_user_id" ON "contest_entry_votes" USING btree ("user_id");--> statement-breakpoint
|
|
1284
|
+
CREATE INDEX "idx_hub_post_votes_post_id" ON "hub_post_votes" USING btree ("post_id");--> statement-breakpoint
|
|
1285
|
+
CREATE INDEX "idx_hub_post_votes_user_id" ON "hub_post_votes" USING btree ("user_id");--> statement-breakpoint
|
|
1286
|
+
CREATE INDEX "idx_poll_options_post_id" ON "poll_options" USING btree ("post_id");--> statement-breakpoint
|
|
1287
|
+
CREATE INDEX "idx_poll_votes_option_id" ON "poll_votes" USING btree ("option_id");--> statement-breakpoint
|
|
1288
|
+
CREATE INDEX "idx_poll_votes_user_id" ON "poll_votes" USING btree ("user_id");--> statement-breakpoint
|
|
1289
|
+
CREATE INDEX "idx_api_key_usage_key_time" ON "api_key_usage" USING btree ("key_id","timestamp");--> statement-breakpoint
|
|
1290
|
+
CREATE INDEX "idx_api_keys_prefix" ON "api_keys" USING btree ("prefix");--> statement-breakpoint
|
|
1291
|
+
CREATE INDEX "idx_api_keys_active" ON "api_keys" USING btree ("revoked_at");
|