Files
Synapsis/drizzle/0003_small_reavers.sql
T
AskIt e2fa572e84 feat(swarm): Implement decentralized node discovery and content federation system
- Add swarm node registry with discovery, gossip, and timeline synchronization
- Implement database schema for swarm nodes, seeds, and sync logs with proper indexing
- Create swarm API endpoints for node discovery, gossip protocol, timeline sharing, and announcements
- Add content moderation features with NSFW flagging and muted nodes support
- Implement user settings pages for content filtering and node moderation
- Add background scheduler for automated swarm synchronization and node health checks
- Create .well-known endpoint for swarm protocol discovery
- Remove legacy bot-cron.ts in favor of integrated scheduler system
- Add user account NSFW preferences and age verification tracking
- Update database schema with swarm-related tables and user moderation fields
- Enhance post and user components to support federated content display
- Add instrumentation for monitoring swarm operations and node health
2026-01-25 23:01:29 +01:00

56 lines
2.4 KiB
SQL

CREATE TABLE "swarm_nodes" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"domain" text NOT NULL,
"name" text,
"description" text,
"logo_url" text,
"public_key" text,
"software_version" text,
"user_count" integer,
"post_count" integer,
"discovered_via" text,
"discovered_at" timestamp DEFAULT now() NOT NULL,
"last_seen_at" timestamp DEFAULT now() NOT NULL,
"last_sync_at" timestamp,
"consecutive_failures" integer DEFAULT 0 NOT NULL,
"is_active" boolean DEFAULT true NOT NULL,
"trust_score" integer DEFAULT 50 NOT NULL,
"capabilities" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "swarm_nodes_domain_unique" UNIQUE("domain")
);
--> statement-breakpoint
CREATE TABLE "swarm_seeds" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"domain" text NOT NULL,
"priority" integer DEFAULT 100 NOT NULL,
"is_enabled" boolean DEFAULT true NOT NULL,
"last_contact_at" timestamp,
"consecutive_failures" integer DEFAULT 0 NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "swarm_seeds_domain_unique" UNIQUE("domain")
);
--> statement-breakpoint
CREATE TABLE "swarm_sync_log" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"remote_domain" text NOT NULL,
"direction" text NOT NULL,
"nodes_received" integer DEFAULT 0 NOT NULL,
"nodes_sent" integer DEFAULT 0 NOT NULL,
"handles_received" integer DEFAULT 0 NOT NULL,
"handles_sent" integer DEFAULT 0 NOT NULL,
"success" boolean NOT NULL,
"error_message" text,
"duration_ms" integer,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE INDEX "swarm_nodes_domain_idx" ON "swarm_nodes" USING btree ("domain");--> statement-breakpoint
CREATE INDEX "swarm_nodes_active_idx" ON "swarm_nodes" USING btree ("is_active");--> statement-breakpoint
CREATE INDEX "swarm_nodes_last_seen_idx" ON "swarm_nodes" USING btree ("last_seen_at");--> statement-breakpoint
CREATE INDEX "swarm_nodes_trust_idx" ON "swarm_nodes" USING btree ("trust_score");--> statement-breakpoint
CREATE INDEX "swarm_seeds_enabled_idx" ON "swarm_seeds" USING btree ("is_enabled");--> statement-breakpoint
CREATE INDEX "swarm_seeds_priority_idx" ON "swarm_seeds" USING btree ("priority");--> statement-breakpoint
CREATE INDEX "swarm_sync_log_remote_idx" ON "swarm_sync_log" USING btree ("remote_domain");--> statement-breakpoint
CREATE INDEX "swarm_sync_log_created_idx" ON "swarm_sync_log" USING btree ("created_at");