This commit is contained in:
@@ -1,369 +0,0 @@
|
||||
CREATE TABLE "blocks" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"blocked_user_id" uuid NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bot_activity_logs" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"bot_id" uuid NOT NULL,
|
||||
"action" text NOT NULL,
|
||||
"details" text NOT NULL,
|
||||
"success" boolean NOT NULL,
|
||||
"error_message" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bot_content_items" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"source_id" uuid NOT NULL,
|
||||
"external_id" text NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"content" text,
|
||||
"url" text NOT NULL,
|
||||
"published_at" timestamp NOT NULL,
|
||||
"fetched_at" timestamp DEFAULT now() NOT NULL,
|
||||
"is_processed" boolean DEFAULT false NOT NULL,
|
||||
"processed_at" timestamp,
|
||||
"post_id" uuid,
|
||||
"interest_score" integer,
|
||||
"interest_reason" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bot_content_sources" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"bot_id" uuid NOT NULL,
|
||||
"type" text NOT NULL,
|
||||
"url" text NOT NULL,
|
||||
"subreddit" text,
|
||||
"api_key_encrypted" text,
|
||||
"fetch_interval_minutes" integer DEFAULT 30 NOT NULL,
|
||||
"keywords" text,
|
||||
"is_active" boolean DEFAULT true NOT NULL,
|
||||
"last_fetch_at" timestamp,
|
||||
"last_error" text,
|
||||
"consecutive_errors" integer DEFAULT 0 NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bot_mentions" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"bot_id" uuid NOT NULL,
|
||||
"post_id" uuid NOT NULL,
|
||||
"author_id" uuid NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"is_processed" boolean DEFAULT false NOT NULL,
|
||||
"processed_at" timestamp,
|
||||
"response_post_id" uuid,
|
||||
"is_remote" boolean DEFAULT false NOT NULL,
|
||||
"remote_actor_url" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bot_rate_limits" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"bot_id" uuid NOT NULL,
|
||||
"window_start" timestamp NOT NULL,
|
||||
"window_type" text NOT NULL,
|
||||
"post_count" integer DEFAULT 0 NOT NULL,
|
||||
"reply_count" integer DEFAULT 0 NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "bots" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"handle" text NOT NULL,
|
||||
"bio" text,
|
||||
"avatar_url" text,
|
||||
"personality_config" text NOT NULL,
|
||||
"llm_provider" text NOT NULL,
|
||||
"llm_model" text NOT NULL,
|
||||
"llm_api_key_encrypted" text NOT NULL,
|
||||
"schedule_config" text,
|
||||
"autonomous_mode" boolean DEFAULT false NOT NULL,
|
||||
"is_active" boolean DEFAULT true NOT NULL,
|
||||
"is_suspended" boolean DEFAULT false NOT NULL,
|
||||
"suspension_reason" text,
|
||||
"suspended_at" timestamp,
|
||||
"public_key" text NOT NULL,
|
||||
"private_key_encrypted" text NOT NULL,
|
||||
"last_post_at" timestamp,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "bots_handle_unique" UNIQUE("handle")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "follows" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"follower_id" uuid NOT NULL,
|
||||
"following_id" uuid NOT NULL,
|
||||
"ap_id" text,
|
||||
"pending" boolean DEFAULT false,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "follows_ap_id_unique" UNIQUE("ap_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "handle_registry" (
|
||||
"handle" text PRIMARY KEY NOT NULL,
|
||||
"did" text NOT NULL,
|
||||
"node_domain" text NOT NULL,
|
||||
"registered_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "likes" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"post_id" uuid NOT NULL,
|
||||
"ap_id" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "likes_ap_id_unique" UNIQUE("ap_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "media" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"post_id" uuid,
|
||||
"url" text NOT NULL,
|
||||
"alt_text" text,
|
||||
"mime_type" text,
|
||||
"width" integer,
|
||||
"height" integer,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "mutes" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"muted_user_id" uuid NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "nodes" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"domain" text NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
"description" text,
|
||||
"long_description" text,
|
||||
"rules" text,
|
||||
"banner_url" text,
|
||||
"accent_color" text DEFAULT '#FFFFFF',
|
||||
"public_key" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "nodes_domain_unique" UNIQUE("domain")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "notifications" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"actor_id" uuid NOT NULL,
|
||||
"post_id" uuid,
|
||||
"type" text NOT NULL,
|
||||
"read_at" timestamp,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "posts" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"content" text NOT NULL,
|
||||
"reply_to_id" uuid,
|
||||
"repost_of_id" uuid,
|
||||
"likes_count" integer DEFAULT 0 NOT NULL,
|
||||
"reposts_count" integer DEFAULT 0 NOT NULL,
|
||||
"replies_count" integer DEFAULT 0 NOT NULL,
|
||||
"is_removed" boolean DEFAULT false NOT NULL,
|
||||
"removed_at" timestamp,
|
||||
"removed_by" uuid,
|
||||
"removed_reason" text,
|
||||
"ap_id" text,
|
||||
"ap_url" text,
|
||||
"link_preview_url" text,
|
||||
"link_preview_title" text,
|
||||
"link_preview_description" text,
|
||||
"link_preview_image" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "posts_ap_id_unique" UNIQUE("ap_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "remote_followers" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"actor_url" text NOT NULL,
|
||||
"inbox_url" text NOT NULL,
|
||||
"shared_inbox_url" text,
|
||||
"handle" text,
|
||||
"activity_id" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "remote_followers_actor_url_unique" UNIQUE("actor_url")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "remote_follows" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"follower_id" uuid NOT NULL,
|
||||
"target_handle" text NOT NULL,
|
||||
"target_actor_url" text NOT NULL,
|
||||
"inbox_url" text NOT NULL,
|
||||
"activity_id" text NOT NULL,
|
||||
"display_name" text,
|
||||
"bio" text,
|
||||
"avatar_url" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "remote_posts" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"ap_id" text NOT NULL,
|
||||
"author_handle" text NOT NULL,
|
||||
"author_actor_url" text NOT NULL,
|
||||
"author_display_name" text,
|
||||
"author_avatar_url" text,
|
||||
"content" text NOT NULL,
|
||||
"published_at" timestamp NOT NULL,
|
||||
"link_preview_url" text,
|
||||
"link_preview_title" text,
|
||||
"link_preview_description" text,
|
||||
"link_preview_image" text,
|
||||
"media_json" text,
|
||||
"fetched_at" timestamp DEFAULT now() NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "remote_posts_ap_id_unique" UNIQUE("ap_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "reports" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"reporter_id" uuid,
|
||||
"target_type" text NOT NULL,
|
||||
"target_id" uuid NOT NULL,
|
||||
"reason" text NOT NULL,
|
||||
"status" text DEFAULT 'open' NOT NULL,
|
||||
"resolved_at" timestamp,
|
||||
"resolved_by" uuid,
|
||||
"resolution_note" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "sessions" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"token" text NOT NULL,
|
||||
"expires_at" timestamp NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "sessions_token_unique" UNIQUE("token")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "users" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"did" text NOT NULL,
|
||||
"handle" text NOT NULL,
|
||||
"email" text,
|
||||
"password_hash" text,
|
||||
"display_name" text,
|
||||
"bio" text,
|
||||
"avatar_url" text,
|
||||
"header_url" text,
|
||||
"private_key_encrypted" text,
|
||||
"public_key" text NOT NULL,
|
||||
"node_id" uuid,
|
||||
"is_suspended" boolean DEFAULT false NOT NULL,
|
||||
"suspension_reason" text,
|
||||
"suspended_at" timestamp,
|
||||
"is_silenced" boolean DEFAULT false NOT NULL,
|
||||
"silence_reason" text,
|
||||
"silenced_at" timestamp,
|
||||
"moved_to" text,
|
||||
"moved_from" text,
|
||||
"migrated_at" timestamp,
|
||||
"followers_count" integer DEFAULT 0 NOT NULL,
|
||||
"following_count" integer DEFAULT 0 NOT NULL,
|
||||
"posts_count" integer DEFAULT 0 NOT NULL,
|
||||
"website" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "users_did_unique" UNIQUE("did"),
|
||||
CONSTRAINT "users_handle_unique" UNIQUE("handle"),
|
||||
CONSTRAINT "users_email_unique" UNIQUE("email")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "blocks" ADD CONSTRAINT "blocks_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "blocks" ADD CONSTRAINT "blocks_blocked_user_id_users_id_fk" FOREIGN KEY ("blocked_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_activity_logs" ADD CONSTRAINT "bot_activity_logs_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_source_id_bot_content_sources_id_fk" FOREIGN KEY ("source_id") REFERENCES "public"."bot_content_sources"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_sources" ADD CONSTRAINT "bot_content_sources_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_mentions" ADD CONSTRAINT "bot_mentions_response_post_id_posts_id_fk" FOREIGN KEY ("response_post_id") REFERENCES "public"."posts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bot_rate_limits" ADD CONSTRAINT "bot_rate_limits_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bots" ADD CONSTRAINT "bots_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
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
|
||||
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
|
||||
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
|
||||
ALTER TABLE "likes" ADD CONSTRAINT "likes_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "media" ADD CONSTRAINT "media_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "media" ADD CONSTRAINT "media_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "mutes" ADD CONSTRAINT "mutes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "mutes" ADD CONSTRAINT "mutes_muted_user_id_users_id_fk" FOREIGN KEY ("muted_user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
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
|
||||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_actor_id_users_id_fk" FOREIGN KEY ("actor_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD CONSTRAINT "posts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD CONSTRAINT "posts_removed_by_users_id_fk" FOREIGN KEY ("removed_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "remote_followers" ADD CONSTRAINT "remote_followers_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "remote_follows" ADD CONSTRAINT "remote_follows_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "reports" ADD CONSTRAINT "reports_reporter_id_users_id_fk" FOREIGN KEY ("reporter_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "reports" ADD CONSTRAINT "reports_resolved_by_users_id_fk" FOREIGN KEY ("resolved_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
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
|
||||
ALTER TABLE "users" ADD CONSTRAINT "users_node_id_nodes_id_fk" FOREIGN KEY ("node_id") REFERENCES "public"."nodes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "blocks_user_idx" ON "blocks" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_activity_logs_bot_idx" ON "bot_activity_logs" USING btree ("bot_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_activity_logs_action_idx" ON "bot_activity_logs" USING btree ("action");--> statement-breakpoint
|
||||
CREATE INDEX "bot_activity_logs_created_idx" ON "bot_activity_logs" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "bot_content_items_source_idx" ON "bot_content_items" USING btree ("source_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_content_items_processed_idx" ON "bot_content_items" USING btree ("is_processed");--> statement-breakpoint
|
||||
CREATE INDEX "bot_content_items_external_idx" ON "bot_content_items" USING btree ("external_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_content_sources_bot_idx" ON "bot_content_sources" USING btree ("bot_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_content_sources_type_idx" ON "bot_content_sources" USING btree ("type");--> statement-breakpoint
|
||||
CREATE INDEX "bot_mentions_bot_idx" ON "bot_mentions" USING btree ("bot_id");--> statement-breakpoint
|
||||
CREATE INDEX "bot_mentions_processed_idx" ON "bot_mentions" USING btree ("is_processed");--> statement-breakpoint
|
||||
CREATE INDEX "bot_mentions_created_idx" ON "bot_mentions" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "bot_rate_limits_bot_window_idx" ON "bot_rate_limits" USING btree ("bot_id","window_start");--> statement-breakpoint
|
||||
CREATE INDEX "bots_user_id_idx" ON "bots" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "bots_handle_idx" ON "bots" USING btree ("handle");--> statement-breakpoint
|
||||
CREATE INDEX "bots_active_idx" ON "bots" USING btree ("is_active");--> statement-breakpoint
|
||||
CREATE INDEX "follows_follower_idx" ON "follows" USING btree ("follower_id");--> statement-breakpoint
|
||||
CREATE INDEX "follows_following_idx" ON "follows" USING btree ("following_id");--> statement-breakpoint
|
||||
CREATE INDEX "handle_registry_updated_idx" ON "handle_registry" USING btree ("updated_at");--> statement-breakpoint
|
||||
CREATE INDEX "likes_user_post_idx" ON "likes" USING btree ("user_id","post_id");--> statement-breakpoint
|
||||
CREATE INDEX "media_user_idx" ON "media" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "media_post_idx" ON "media" USING btree ("post_id");--> statement-breakpoint
|
||||
CREATE INDEX "mutes_user_idx" ON "mutes" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "notifications_user_idx" ON "notifications" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "notifications_created_idx" ON "notifications" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "posts_user_id_idx" ON "posts" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "posts_created_at_idx" ON "posts" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "posts_reply_to_idx" ON "posts" USING btree ("reply_to_id");--> statement-breakpoint
|
||||
CREATE INDEX "posts_removed_idx" ON "posts" USING btree ("is_removed");--> statement-breakpoint
|
||||
CREATE INDEX "remote_followers_user_idx" ON "remote_followers" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "remote_followers_actor_idx" ON "remote_followers" USING btree ("actor_url");--> statement-breakpoint
|
||||
CREATE INDEX "remote_follows_follower_idx" ON "remote_follows" USING btree ("follower_id");--> statement-breakpoint
|
||||
CREATE INDEX "remote_follows_target_idx" ON "remote_follows" USING btree ("target_handle");--> statement-breakpoint
|
||||
CREATE INDEX "remote_posts_author_idx" ON "remote_posts" USING btree ("author_handle");--> statement-breakpoint
|
||||
CREATE INDEX "remote_posts_published_idx" ON "remote_posts" USING btree ("published_at");--> statement-breakpoint
|
||||
CREATE INDEX "remote_posts_ap_id_idx" ON "remote_posts" USING btree ("ap_id");--> statement-breakpoint
|
||||
CREATE INDEX "reports_status_idx" ON "reports" USING btree ("status");--> statement-breakpoint
|
||||
CREATE INDEX "reports_target_idx" ON "reports" USING btree ("target_type","target_id");--> statement-breakpoint
|
||||
CREATE INDEX "reports_reporter_idx" ON "reports" USING btree ("reporter_id");--> statement-breakpoint
|
||||
CREATE INDEX "sessions_token_idx" ON "sessions" USING btree ("token");--> statement-breakpoint
|
||||
CREATE INDEX "sessions_user_idx" ON "sessions" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "users_handle_idx" ON "users" USING btree ("handle");--> statement-breakpoint
|
||||
CREATE INDEX "users_did_idx" ON "users" USING btree ("did");--> statement-breakpoint
|
||||
CREATE INDEX "users_suspended_idx" ON "users" USING btree ("is_suspended");--> statement-breakpoint
|
||||
CREATE INDEX "users_silenced_idx" ON "users" USING btree ("is_silenced");
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Remove fetch_interval_minutes column from bot_content_sources
|
||||
ALTER TABLE "bot_content_sources" DROP COLUMN IF EXISTS "fetch_interval_minutes";
|
||||
@@ -1,5 +0,0 @@
|
||||
-- Add bot_id column to posts table
|
||||
ALTER TABLE "posts" ADD COLUMN "bot_id" uuid REFERENCES "bots"("id") ON DELETE SET NULL;
|
||||
|
||||
-- Create index for bot_id
|
||||
CREATE INDEX IF NOT EXISTS "posts_bot_id_idx" ON "posts" ("bot_id");
|
||||
@@ -1,24 +0,0 @@
|
||||
ALTER TABLE "bots" DROP CONSTRAINT "bots_handle_unique";--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_items" DROP CONSTRAINT "bot_content_items_post_id_posts_id_fk";
|
||||
--> statement-breakpoint
|
||||
DROP INDEX "bots_handle_idx";--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_sources" ADD COLUMN "source_config" text;--> statement-breakpoint
|
||||
ALTER TABLE "bots" ADD COLUMN "owner_id" uuid NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "logo_url" text;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD COLUMN "bot_id" uuid;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "is_bot" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "bot_owner_id" uuid;--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "bots" ADD CONSTRAINT "bots_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD CONSTRAINT "posts_bot_id_bots_id_fk" FOREIGN KEY ("bot_id") REFERENCES "public"."bots"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD CONSTRAINT "users_bot_owner_id_users_id_fk" FOREIGN KEY ("bot_owner_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "bots_owner_id_idx" ON "bots" USING btree ("owner_id");--> statement-breakpoint
|
||||
CREATE INDEX "posts_bot_id_idx" ON "posts" USING btree ("bot_id");--> statement-breakpoint
|
||||
CREATE INDEX "users_is_bot_idx" ON "users" USING btree ("is_bot");--> statement-breakpoint
|
||||
CREATE INDEX "users_bot_owner_idx" ON "users" USING btree ("bot_owner_id");--> statement-breakpoint
|
||||
ALTER TABLE "bot_content_sources" DROP COLUMN "fetch_interval_minutes";--> statement-breakpoint
|
||||
ALTER TABLE "bots" DROP COLUMN "handle";--> statement-breakpoint
|
||||
ALTER TABLE "bots" DROP COLUMN "bio";--> statement-breakpoint
|
||||
ALTER TABLE "bots" DROP COLUMN "avatar_url";--> statement-breakpoint
|
||||
ALTER TABLE "bots" DROP COLUMN "public_key";--> statement-breakpoint
|
||||
ALTER TABLE "bots" DROP COLUMN "private_key_encrypted";
|
||||
@@ -1,4 +0,0 @@
|
||||
-- Fix bot_content_items post_id foreign key to allow cascade on delete
|
||||
ALTER TABLE "bot_content_items" DROP CONSTRAINT IF EXISTS "bot_content_items_post_id_posts_id_fk";
|
||||
ALTER TABLE "bot_content_items" ADD CONSTRAINT "bot_content_items_post_id_posts_id_fk"
|
||||
FOREIGN KEY ("post_id") REFERENCES "posts"("id") ON DELETE SET NULL;
|
||||
@@ -1,56 +0,0 @@
|
||||
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");
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Add source_config column for Brave News and News API query builder configurations
|
||||
ALTER TABLE "bot_content_sources" ADD COLUMN "source_config" text;
|
||||
@@ -1,21 +0,0 @@
|
||||
CREATE TABLE "muted_nodes" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"node_domain" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "swarm_nodes" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "is_nsfw" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "nsfw_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "age_verified_at" timestamp;--> statement-breakpoint
|
||||
ALTER TABLE "muted_nodes" ADD CONSTRAINT "muted_nodes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "muted_nodes_user_idx" ON "muted_nodes" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "muted_nodes_domain_idx" ON "muted_nodes" USING btree ("node_domain");--> statement-breakpoint
|
||||
CREATE INDEX "blocks_blocked_user_idx" ON "blocks" USING btree ("blocked_user_id");--> statement-breakpoint
|
||||
CREATE INDEX "mutes_muted_user_idx" ON "mutes" USING btree ("muted_user_id");--> statement-breakpoint
|
||||
CREATE INDEX "posts_nsfw_idx" ON "posts" USING btree ("is_nsfw");--> statement-breakpoint
|
||||
CREATE INDEX "swarm_nodes_nsfw_idx" ON "swarm_nodes" USING btree ("is_nsfw");--> statement-breakpoint
|
||||
CREATE INDEX "users_nsfw_idx" ON "users" USING btree ("is_nsfw");
|
||||
@@ -1,34 +0,0 @@
|
||||
-- Bots as First-Class Users Migration
|
||||
-- This migration transforms bots to have their own user accounts
|
||||
|
||||
-- Add bot-related fields to users table
|
||||
ALTER TABLE "users" ADD COLUMN "is_bot" boolean DEFAULT false NOT NULL;
|
||||
ALTER TABLE "users" ADD COLUMN "bot_owner_id" uuid REFERENCES "users"("id") ON DELETE CASCADE;
|
||||
|
||||
-- Create indexes for bot fields
|
||||
CREATE INDEX IF NOT EXISTS "users_is_bot_idx" ON "users" ("is_bot");
|
||||
CREATE INDEX IF NOT EXISTS "users_bot_owner_idx" ON "users" ("bot_owner_id");
|
||||
|
||||
-- Add owner_id to bots table (will be populated during migration)
|
||||
ALTER TABLE "bots" ADD COLUMN "owner_id" uuid REFERENCES "users"("id") ON DELETE CASCADE;
|
||||
|
||||
-- Copy existing userId to ownerId (existing bots were owned by the user)
|
||||
UPDATE "bots" SET "owner_id" = "user_id";
|
||||
|
||||
-- Make owner_id NOT NULL after populating
|
||||
ALTER TABLE "bots" ALTER COLUMN "owner_id" SET NOT NULL;
|
||||
|
||||
-- Create index for owner_id
|
||||
CREATE INDEX IF NOT EXISTS "bots_owner_id_idx" ON "bots" ("owner_id");
|
||||
|
||||
-- Remove columns that are now on the user account
|
||||
-- Note: handle, bio, avatarUrl, publicKey, privateKeyEncrypted move to users table
|
||||
-- We'll keep them for now and handle migration in application code
|
||||
-- ALTER TABLE "bots" DROP COLUMN "handle";
|
||||
-- ALTER TABLE "bots" DROP COLUMN "bio";
|
||||
-- ALTER TABLE "bots" DROP COLUMN "avatar_url";
|
||||
-- ALTER TABLE "bots" DROP COLUMN "public_key";
|
||||
-- ALTER TABLE "bots" DROP COLUMN "private_key_encrypted";
|
||||
|
||||
-- Drop the handle index since handle is now on users
|
||||
DROP INDEX IF EXISTS "bots_handle_idx";
|
||||
@@ -1,3 +0,0 @@
|
||||
ALTER TABLE "remote_followers" DROP CONSTRAINT "remote_followers_actor_url_unique";--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "favicon_url" text;--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "remote_followers_user_actor_unique" ON "remote_followers" USING btree ("user_id","actor_url");
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Add favicon_url column to nodes table
|
||||
ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "favicon_url" text;
|
||||
@@ -1,29 +0,0 @@
|
||||
CREATE TABLE "remote_likes" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"post_id" uuid NOT NULL,
|
||||
"actor_handle" text NOT NULL,
|
||||
"actor_node_domain" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "remote_reposts" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"post_id" uuid NOT NULL,
|
||||
"actor_handle" text NOT NULL,
|
||||
"actor_node_domain" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "turnstile_site_key" text;--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "turnstile_secret_key" text;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_id" text;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_content" text;--> statement-breakpoint
|
||||
ALTER TABLE "posts" ADD COLUMN "swarm_reply_to_author" text;--> statement-breakpoint
|
||||
ALTER TABLE "remote_likes" ADD CONSTRAINT "remote_likes_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "remote_reposts" ADD CONSTRAINT "remote_reposts_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "remote_likes_post_idx" ON "remote_likes" USING btree ("post_id");--> statement-breakpoint
|
||||
CREATE INDEX "remote_likes_actor_idx" ON "remote_likes" USING btree ("actor_handle","actor_node_domain");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "remote_likes_unique" ON "remote_likes" USING btree ("post_id","actor_handle","actor_node_domain");--> statement-breakpoint
|
||||
CREATE INDEX "remote_reposts_post_idx" ON "remote_reposts" USING btree ("post_id");--> statement-breakpoint
|
||||
CREATE INDEX "remote_reposts_actor_idx" ON "remote_reposts" USING btree ("actor_handle","actor_node_domain");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "remote_reposts_unique" ON "remote_reposts" USING btree ("post_id","actor_handle","actor_node_domain");
|
||||
@@ -1,46 +0,0 @@
|
||||
CREATE TABLE "chat_conversations" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"type" text DEFAULT 'direct' NOT NULL,
|
||||
"participant1_id" uuid NOT NULL,
|
||||
"participant2_handle" text NOT NULL,
|
||||
"last_message_at" timestamp,
|
||||
"last_message_preview" text,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"updated_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "chat_messages" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"conversation_id" uuid NOT NULL,
|
||||
"sender_handle" text NOT NULL,
|
||||
"sender_display_name" text,
|
||||
"sender_avatar_url" text,
|
||||
"sender_node_domain" text,
|
||||
"encrypted_content" text NOT NULL,
|
||||
"swarm_message_id" text,
|
||||
"delivered_at" timestamp,
|
||||
"read_at" timestamp,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "chat_messages_swarm_message_id_unique" UNIQUE("swarm_message_id")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "chat_typing_indicators" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"conversation_id" uuid NOT NULL,
|
||||
"user_handle" text NOT NULL,
|
||||
"expires_at" timestamp NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "chat_conversations" ADD CONSTRAINT "chat_conversations_participant1_id_users_id_fk" FOREIGN KEY ("participant1_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "chat_messages" ADD CONSTRAINT "chat_messages_conversation_id_chat_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."chat_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "chat_typing_indicators" ADD CONSTRAINT "chat_typing_indicators_conversation_id_chat_conversations_id_fk" FOREIGN KEY ("conversation_id") REFERENCES "public"."chat_conversations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "chat_conversations_participant1_idx" ON "chat_conversations" USING btree ("participant1_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_conversations_last_message_idx" ON "chat_conversations" USING btree ("last_message_at");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "chat_conversations_unique" ON "chat_conversations" USING btree ("participant1_id","participant2_handle");--> statement-breakpoint
|
||||
CREATE INDEX "chat_messages_conversation_idx" ON "chat_messages" USING btree ("conversation_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_messages_created_idx" ON "chat_messages" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "chat_messages_swarm_id_idx" ON "chat_messages" USING btree ("swarm_message_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_typing_conversation_idx" ON "chat_typing_indicators" USING btree ("conversation_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_typing_expires_idx" ON "chat_typing_indicators" USING btree ("expires_at");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "chat_typing_unique" ON "chat_typing_indicators" USING btree ("conversation_id","user_handle");
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Add private_key_encrypted column to nodes table for cryptographic signing
|
||||
ALTER TABLE "nodes" ADD COLUMN "private_key_encrypted" text;
|
||||
@@ -1,21 +0,0 @@
|
||||
CREATE TABLE "remote_identity_cache" (
|
||||
"did" text PRIMARY KEY NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"fetched_at" timestamp NOT NULL,
|
||||
"expires_at" timestamp NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "signed_action_dedupe" (
|
||||
"action_id" text PRIMARY KEY NOT NULL,
|
||||
"did" text NOT NULL,
|
||||
"nonce" text NOT NULL,
|
||||
"ts" bigint NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "chat_messages" ADD COLUMN "sender_encrypted_content" text;--> statement-breakpoint
|
||||
ALTER TABLE "chat_messages" ADD COLUMN "sender_chat_public_key" text;--> statement-breakpoint
|
||||
ALTER TABLE "nodes" ADD COLUMN "private_key_encrypted" text;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "chat_public_key" text;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "chat_private_key_encrypted" text;--> statement-breakpoint
|
||||
CREATE INDEX "signed_action_dedupe_created_idx" ON "signed_action_dedupe" USING btree ("created_at");
|
||||
@@ -1,43 +0,0 @@
|
||||
CREATE TABLE "chat_device_bundles" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"did" text NOT NULL,
|
||||
"device_id" text NOT NULL,
|
||||
"identity_key" text NOT NULL,
|
||||
"signed_pre_key" text NOT NULL,
|
||||
"signature" text NOT NULL,
|
||||
"last_seen_at" timestamp DEFAULT now() NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "chat_inbox" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"recipient_did" text NOT NULL,
|
||||
"recipient_device_id" text,
|
||||
"sender_did" text NOT NULL,
|
||||
"envelope_json" text NOT NULL,
|
||||
"is_read" boolean DEFAULT false NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"expires_at" timestamp NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "chat_one_time_keys" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"user_id" uuid NOT NULL,
|
||||
"bundle_id" uuid NOT NULL,
|
||||
"key_id" integer NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "chat_messages" ADD COLUMN "sender_did" text;--> statement-breakpoint
|
||||
ALTER TABLE "chat_device_bundles" ADD CONSTRAINT "chat_device_bundles_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "chat_one_time_keys" ADD CONSTRAINT "chat_one_time_keys_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "chat_one_time_keys" ADD CONSTRAINT "chat_one_time_keys_bundle_id_chat_device_bundles_id_fk" FOREIGN KEY ("bundle_id") REFERENCES "public"."chat_device_bundles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
CREATE INDEX "chat_bundles_user_idx" ON "chat_device_bundles" USING btree ("user_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_bundles_did_idx" ON "chat_device_bundles" USING btree ("did");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "chat_bundles_device_unique" ON "chat_device_bundles" USING btree ("user_id","device_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_inbox_recipient_idx" ON "chat_inbox" USING btree ("recipient_did","recipient_device_id");--> statement-breakpoint
|
||||
CREATE INDEX "chat_inbox_created_idx" ON "chat_inbox" USING btree ("created_at");--> statement-breakpoint
|
||||
CREATE INDEX "chat_otk_bundle_idx" ON "chat_one_time_keys" USING btree ("bundle_id");--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "chat_otk_unique" ON "chat_one_time_keys" USING btree ("bundle_id","key_id");
|
||||
@@ -1,3 +0,0 @@
|
||||
-- Migration: Add user storage columns
|
||||
ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_provider" text;
|
||||
ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_api_key_encrypted" text;
|
||||
@@ -1,3 +0,0 @@
|
||||
-- Migration: Add logo_data and favicon_data columns for base64 storage
|
||||
ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "logo_data" text;
|
||||
ALTER TABLE "nodes" ADD COLUMN IF NOT EXISTS "favicon_data" text;
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Migration: Add storage_public_base_url column to users table
|
||||
ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "storage_public_base_url" text;
|
||||
@@ -0,0 +1,620 @@
|
||||
CREATE TABLE `blocks` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`blocked_user_id` text NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_blocks_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_blocks_blocked_user_id_users_id_fk` FOREIGN KEY (`blocked_user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bot_activity_logs` (
|
||||
`id` text PRIMARY KEY,
|
||||
`bot_id` text NOT NULL,
|
||||
`action` text NOT NULL,
|
||||
`details` text NOT NULL,
|
||||
`success` integer NOT NULL,
|
||||
`error_message` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_bot_activity_logs_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bot_content_items` (
|
||||
`id` text PRIMARY KEY,
|
||||
`source_id` text NOT NULL,
|
||||
`external_id` text NOT NULL,
|
||||
`title` text NOT NULL,
|
||||
`content` text,
|
||||
`url` text NOT NULL,
|
||||
`published_at` integer NOT NULL,
|
||||
`fetched_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`is_processed` integer DEFAULT false NOT NULL,
|
||||
`processed_at` integer,
|
||||
`post_id` text,
|
||||
`interest_score` integer,
|
||||
`interest_reason` text,
|
||||
CONSTRAINT `fk_bot_content_items_source_id_bot_content_sources_id_fk` FOREIGN KEY (`source_id`) REFERENCES `bot_content_sources`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_bot_content_items_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE SET NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bot_content_sources` (
|
||||
`id` text PRIMARY KEY,
|
||||
`bot_id` text NOT NULL,
|
||||
`type` text NOT NULL,
|
||||
`url` text NOT NULL,
|
||||
`subreddit` text,
|
||||
`api_key_encrypted` text,
|
||||
`source_config` text,
|
||||
`keywords` text,
|
||||
`is_active` integer DEFAULT true NOT NULL,
|
||||
`last_fetch_at` integer,
|
||||
`last_error` text,
|
||||
`consecutive_errors` integer DEFAULT 0 NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_bot_content_sources_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bot_mentions` (
|
||||
`id` text PRIMARY KEY,
|
||||
`bot_id` text NOT NULL,
|
||||
`post_id` text NOT NULL,
|
||||
`author_id` text NOT NULL,
|
||||
`content` text NOT NULL,
|
||||
`is_processed` integer DEFAULT false NOT NULL,
|
||||
`processed_at` integer,
|
||||
`response_post_id` text,
|
||||
`is_remote` integer DEFAULT false NOT NULL,
|
||||
`remote_actor_url` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_bot_mentions_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_bot_mentions_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_bot_mentions_author_id_users_id_fk` FOREIGN KEY (`author_id`) REFERENCES `users`(`id`),
|
||||
CONSTRAINT `fk_bot_mentions_response_post_id_posts_id_fk` FOREIGN KEY (`response_post_id`) REFERENCES `posts`(`id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bot_rate_limits` (
|
||||
`id` text PRIMARY KEY,
|
||||
`bot_id` text NOT NULL,
|
||||
`window_start` integer NOT NULL,
|
||||
`window_type` text NOT NULL,
|
||||
`post_count` integer DEFAULT 0 NOT NULL,
|
||||
`reply_count` integer DEFAULT 0 NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_bot_rate_limits_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `bots` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`owner_id` text NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`personality_config` text NOT NULL,
|
||||
`llm_provider` text NOT NULL,
|
||||
`llm_model` text NOT NULL,
|
||||
`llm_endpoint` text,
|
||||
`llm_api_key_encrypted` text NOT NULL,
|
||||
`schedule_config` text,
|
||||
`autonomous_mode` integer DEFAULT false NOT NULL,
|
||||
`is_active` integer DEFAULT true NOT NULL,
|
||||
`is_suspended` integer DEFAULT false NOT NULL,
|
||||
`suspension_reason` text,
|
||||
`suspended_at` integer,
|
||||
`last_post_at` integer,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_bots_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_bots_owner_id_users_id_fk` FOREIGN KEY (`owner_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `chat_conversations` (
|
||||
`id` text PRIMARY KEY,
|
||||
`type` text DEFAULT 'direct' NOT NULL,
|
||||
`participant1_id` text NOT NULL,
|
||||
`participant2_handle` text NOT NULL,
|
||||
`last_message_at` integer,
|
||||
`last_message_preview` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_chat_conversations_participant1_id_users_id_fk` FOREIGN KEY (`participant1_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `chat_messages` (
|
||||
`id` text PRIMARY KEY,
|
||||
`conversation_id` text NOT NULL,
|
||||
`sender_handle` text NOT NULL,
|
||||
`sender_display_name` text,
|
||||
`sender_avatar_url` text,
|
||||
`sender_node_domain` text,
|
||||
`sender_did` text,
|
||||
`content` text,
|
||||
`swarm_message_id` text,
|
||||
`delivered_at` integer,
|
||||
`read_at` integer,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_chat_messages_conversation_id_chat_conversations_id_fk` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `chat_typing_indicators` (
|
||||
`id` text PRIMARY KEY,
|
||||
`conversation_id` text NOT NULL,
|
||||
`user_handle` text NOT NULL,
|
||||
`expires_at` integer NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_chat_typing_indicators_conversation_id_chat_conversations_id_fk` FOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `follows` (
|
||||
`id` text PRIMARY KEY,
|
||||
`follower_id` text NOT NULL,
|
||||
`following_id` text NOT NULL,
|
||||
`ap_id` text UNIQUE,
|
||||
`pending` integer DEFAULT false,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_follows_follower_id_users_id_fk` FOREIGN KEY (`follower_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_follows_following_id_users_id_fk` FOREIGN KEY (`following_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `handle_registry` (
|
||||
`handle` text PRIMARY KEY,
|
||||
`did` text NOT NULL,
|
||||
`node_domain` text NOT NULL,
|
||||
`registered_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `likes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`post_id` text NOT NULL,
|
||||
`ap_id` text UNIQUE,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_likes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_likes_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `media` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`post_id` text,
|
||||
`url` text NOT NULL,
|
||||
`alt_text` text,
|
||||
`mime_type` text,
|
||||
`width` integer,
|
||||
`height` integer,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_media_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_media_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `muted_nodes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`node_domain` text NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_muted_nodes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `mutes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`muted_user_id` text NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_mutes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_mutes_muted_user_id_users_id_fk` FOREIGN KEY (`muted_user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `nodes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`domain` text NOT NULL UNIQUE,
|
||||
`name` text NOT NULL,
|
||||
`description` text,
|
||||
`long_description` text,
|
||||
`rules` text,
|
||||
`banner_url` text,
|
||||
`logo_url` text,
|
||||
`favicon_url` text,
|
||||
`logo_data` text,
|
||||
`favicon_data` text,
|
||||
`accent_color` text DEFAULT '#FFFFFF',
|
||||
`public_key` text,
|
||||
`private_key_encrypted` text,
|
||||
`is_nsfw` integer DEFAULT false NOT NULL,
|
||||
`turnstile_site_key` text,
|
||||
`turnstile_secret_key` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `notifications` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`actor_id` text,
|
||||
`actor_handle` text NOT NULL,
|
||||
`actor_display_name` text,
|
||||
`actor_avatar_url` text,
|
||||
`actor_node_domain` text,
|
||||
`target_handle` text,
|
||||
`target_display_name` text,
|
||||
`target_avatar_url` text,
|
||||
`target_node_domain` text,
|
||||
`target_is_bot` integer,
|
||||
`post_id` text,
|
||||
`post_content` text,
|
||||
`type` text NOT NULL,
|
||||
`read_at` integer,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_notifications_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_notifications_actor_id_users_id_fk` FOREIGN KEY (`actor_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_notifications_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `posts` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`bot_id` text,
|
||||
`content` text NOT NULL,
|
||||
`reply_to_id` text,
|
||||
`repost_of_id` text,
|
||||
`swarm_reply_to_id` text,
|
||||
`swarm_reply_to_content` text,
|
||||
`swarm_reply_to_author` text,
|
||||
`likes_count` integer DEFAULT 0 NOT NULL,
|
||||
`reposts_count` integer DEFAULT 0 NOT NULL,
|
||||
`replies_count` integer DEFAULT 0 NOT NULL,
|
||||
`is_nsfw` integer DEFAULT false NOT NULL,
|
||||
`is_removed` integer DEFAULT false NOT NULL,
|
||||
`removed_at` integer,
|
||||
`removed_by` text,
|
||||
`removed_reason` text,
|
||||
`ap_id` text UNIQUE,
|
||||
`ap_url` text,
|
||||
`link_preview_url` text,
|
||||
`link_preview_title` text,
|
||||
`link_preview_description` text,
|
||||
`link_preview_image` text,
|
||||
`link_preview_type` text,
|
||||
`link_preview_video_url` text,
|
||||
`link_preview_media_json` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_posts_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_posts_bot_id_bots_id_fk` FOREIGN KEY (`bot_id`) REFERENCES `bots`(`id`) ON DELETE SET NULL,
|
||||
CONSTRAINT `fk_posts_removed_by_users_id_fk` FOREIGN KEY (`removed_by`) REFERENCES `users`(`id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_followers` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`actor_url` text NOT NULL,
|
||||
`inbox_url` text NOT NULL,
|
||||
`shared_inbox_url` text,
|
||||
`handle` text,
|
||||
`activity_id` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_remote_followers_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_follows` (
|
||||
`id` text PRIMARY KEY,
|
||||
`follower_id` text NOT NULL,
|
||||
`target_handle` text NOT NULL,
|
||||
`target_actor_url` text NOT NULL,
|
||||
`inbox_url` text NOT NULL,
|
||||
`activity_id` text NOT NULL,
|
||||
`display_name` text,
|
||||
`bio` text,
|
||||
`avatar_url` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_remote_follows_follower_id_users_id_fk` FOREIGN KEY (`follower_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_identity_cache` (
|
||||
`did` text PRIMARY KEY,
|
||||
`public_key` text NOT NULL,
|
||||
`fetched_at` integer NOT NULL,
|
||||
`expires_at` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_likes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`post_id` text NOT NULL,
|
||||
`actor_handle` text NOT NULL,
|
||||
`actor_node_domain` text NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_remote_likes_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_posts` (
|
||||
`id` text PRIMARY KEY,
|
||||
`ap_id` text NOT NULL,
|
||||
`author_handle` text NOT NULL,
|
||||
`author_actor_url` text NOT NULL,
|
||||
`author_display_name` text,
|
||||
`author_avatar_url` text,
|
||||
`content` text NOT NULL,
|
||||
`published_at` integer NOT NULL,
|
||||
`link_preview_url` text,
|
||||
`link_preview_title` text,
|
||||
`link_preview_description` text,
|
||||
`link_preview_image` text,
|
||||
`link_preview_type` text,
|
||||
`link_preview_video_url` text,
|
||||
`link_preview_media_json` text,
|
||||
`media_json` text,
|
||||
`fetched_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `remote_reposts` (
|
||||
`id` text PRIMARY KEY,
|
||||
`post_id` text NOT NULL,
|
||||
`actor_handle` text NOT NULL,
|
||||
`actor_node_domain` text NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_remote_reposts_post_id_posts_id_fk` FOREIGN KEY (`post_id`) REFERENCES `posts`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `reports` (
|
||||
`id` text PRIMARY KEY,
|
||||
`reporter_id` text,
|
||||
`target_type` text NOT NULL,
|
||||
`target_id` text NOT NULL,
|
||||
`reason` text NOT NULL,
|
||||
`status` text DEFAULT 'open' NOT NULL,
|
||||
`resolved_at` integer,
|
||||
`resolved_by` text,
|
||||
`resolution_note` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_reports_reporter_id_users_id_fk` FOREIGN KEY (`reporter_id`) REFERENCES `users`(`id`) ON DELETE SET NULL,
|
||||
CONSTRAINT `fk_reports_resolved_by_users_id_fk` FOREIGN KEY (`resolved_by`) REFERENCES `users`(`id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `sessions` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`token` text NOT NULL,
|
||||
`expires_at` integer NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_sessions_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `signed_action_dedupe` (
|
||||
`action_id` text PRIMARY KEY,
|
||||
`did` text NOT NULL,
|
||||
`nonce` text NOT NULL,
|
||||
`ts` integer NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `swarm_nodes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`domain` text NOT NULL,
|
||||
`name` text,
|
||||
`description` text,
|
||||
`logo_url` text,
|
||||
`public_key` text,
|
||||
`software_version` text,
|
||||
`user_count` integer,
|
||||
`post_count` integer,
|
||||
`is_nsfw` integer DEFAULT false NOT NULL,
|
||||
`discovered_via` text,
|
||||
`discovered_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`last_seen_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`last_sync_at` integer,
|
||||
`consecutive_failures` integer DEFAULT 0 NOT NULL,
|
||||
`is_active` integer DEFAULT true NOT NULL,
|
||||
`trust_score` integer DEFAULT 50 NOT NULL,
|
||||
`is_blocked` integer DEFAULT false NOT NULL,
|
||||
`block_reason` text,
|
||||
`blocked_at` integer,
|
||||
`capabilities` text,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `swarm_seeds` (
|
||||
`id` text PRIMARY KEY,
|
||||
`domain` text NOT NULL UNIQUE,
|
||||
`priority` integer DEFAULT 100 NOT NULL,
|
||||
`is_enabled` integer DEFAULT true NOT NULL,
|
||||
`last_contact_at` integer,
|
||||
`consecutive_failures` integer DEFAULT 0 NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `swarm_sync_log` (
|
||||
`id` text PRIMARY KEY,
|
||||
`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` integer NOT NULL,
|
||||
`error_message` text,
|
||||
`duration_ms` integer,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user_swarm_likes` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`node_domain` text NOT NULL,
|
||||
`original_post_id` text NOT NULL,
|
||||
`author_handle` text NOT NULL,
|
||||
`author_display_name` text,
|
||||
`author_avatar_url` text,
|
||||
`content` text NOT NULL,
|
||||
`post_created_at` integer NOT NULL,
|
||||
`likes_count` integer DEFAULT 0 NOT NULL,
|
||||
`reposts_count` integer DEFAULT 0 NOT NULL,
|
||||
`replies_count` integer DEFAULT 0 NOT NULL,
|
||||
`link_preview_url` text,
|
||||
`link_preview_title` text,
|
||||
`link_preview_description` text,
|
||||
`link_preview_image` text,
|
||||
`link_preview_type` text,
|
||||
`link_preview_video_url` text,
|
||||
`link_preview_media_json` text,
|
||||
`media_json` text,
|
||||
`liked_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_user_swarm_likes_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user_swarm_reposts` (
|
||||
`id` text PRIMARY KEY,
|
||||
`user_id` text NOT NULL,
|
||||
`node_domain` text NOT NULL,
|
||||
`original_post_id` text NOT NULL,
|
||||
`author_handle` text NOT NULL,
|
||||
`author_display_name` text,
|
||||
`author_avatar_url` text,
|
||||
`content` text NOT NULL,
|
||||
`post_created_at` integer NOT NULL,
|
||||
`likes_count` integer DEFAULT 0 NOT NULL,
|
||||
`reposts_count` integer DEFAULT 0 NOT NULL,
|
||||
`replies_count` integer DEFAULT 0 NOT NULL,
|
||||
`link_preview_url` text,
|
||||
`link_preview_title` text,
|
||||
`link_preview_description` text,
|
||||
`link_preview_image` text,
|
||||
`link_preview_type` text,
|
||||
`link_preview_video_url` text,
|
||||
`link_preview_media_json` text,
|
||||
`media_json` text,
|
||||
`reposted_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_user_swarm_reposts_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `users` (
|
||||
`id` text PRIMARY KEY,
|
||||
`did` text NOT NULL,
|
||||
`handle` text NOT NULL,
|
||||
`email` text UNIQUE,
|
||||
`password_hash` text,
|
||||
`display_name` text,
|
||||
`bio` text,
|
||||
`avatar_url` text,
|
||||
`header_url` text,
|
||||
`private_key_encrypted` text,
|
||||
`public_key` text NOT NULL,
|
||||
`node_id` text,
|
||||
`is_bot` integer DEFAULT false NOT NULL,
|
||||
`bot_owner_id` text,
|
||||
`is_nsfw` integer DEFAULT false NOT NULL,
|
||||
`nsfw_enabled` integer DEFAULT false NOT NULL,
|
||||
`age_verified_at` integer,
|
||||
`is_suspended` integer DEFAULT false NOT NULL,
|
||||
`suspension_reason` text,
|
||||
`suspended_at` integer,
|
||||
`is_silenced` integer DEFAULT false NOT NULL,
|
||||
`silence_reason` text,
|
||||
`silenced_at` integer,
|
||||
`moved_to` text,
|
||||
`moved_from` text,
|
||||
`migrated_at` integer,
|
||||
`storage_provider` text,
|
||||
`storage_endpoint` text,
|
||||
`storage_public_base_url` text,
|
||||
`storage_region` text,
|
||||
`storage_bucket` text,
|
||||
`storage_access_key_encrypted` text,
|
||||
`storage_secret_key_encrypted` text,
|
||||
`followers_count` integer DEFAULT 0 NOT NULL,
|
||||
`following_count` integer DEFAULT 0 NOT NULL,
|
||||
`posts_count` integer DEFAULT 0 NOT NULL,
|
||||
`website` text,
|
||||
`dm_privacy` text DEFAULT 'everyone' NOT NULL,
|
||||
`created_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
`updated_at` integer DEFAULT (unixepoch()) NOT NULL,
|
||||
CONSTRAINT `fk_users_node_id_nodes_id_fk` FOREIGN KEY (`node_id`) REFERENCES `nodes`(`id`),
|
||||
CONSTRAINT `users_bot_owner_id_users_id_fk` FOREIGN KEY (`bot_owner_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `blocks_user_idx` ON `blocks` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `blocks_blocked_user_idx` ON `blocks` (`blocked_user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_activity_logs_bot_idx` ON `bot_activity_logs` (`bot_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_activity_logs_action_idx` ON `bot_activity_logs` (`action`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_activity_logs_created_idx` ON `bot_activity_logs` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_content_items_source_idx` ON `bot_content_items` (`source_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_content_items_processed_idx` ON `bot_content_items` (`is_processed`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_content_items_external_idx` ON `bot_content_items` (`external_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_content_sources_bot_idx` ON `bot_content_sources` (`bot_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_content_sources_type_idx` ON `bot_content_sources` (`type`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_mentions_bot_idx` ON `bot_mentions` (`bot_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_mentions_processed_idx` ON `bot_mentions` (`is_processed`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_mentions_created_idx` ON `bot_mentions` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `bot_rate_limits_bot_window_idx` ON `bot_rate_limits` (`bot_id`,`window_start`);--> statement-breakpoint
|
||||
CREATE INDEX `bots_user_id_idx` ON `bots` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bots_owner_id_idx` ON `bots` (`owner_id`);--> statement-breakpoint
|
||||
CREATE INDEX `bots_active_idx` ON `bots` (`is_active`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_conversations_participant1_idx` ON `chat_conversations` (`participant1_id`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_conversations_last_message_idx` ON `chat_conversations` (`last_message_at`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `chat_conversations_unique` ON `chat_conversations` (`participant1_id`,`participant2_handle`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_messages_conversation_idx` ON `chat_messages` (`conversation_id`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_messages_created_idx` ON `chat_messages` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_messages_swarm_id_idx` ON `chat_messages` (`swarm_message_id`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_typing_conversation_idx` ON `chat_typing_indicators` (`conversation_id`);--> statement-breakpoint
|
||||
CREATE INDEX `chat_typing_expires_idx` ON `chat_typing_indicators` (`expires_at`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `chat_typing_unique` ON `chat_typing_indicators` (`conversation_id`,`user_handle`);--> statement-breakpoint
|
||||
CREATE INDEX `follows_follower_idx` ON `follows` (`follower_id`);--> statement-breakpoint
|
||||
CREATE INDEX `follows_following_idx` ON `follows` (`following_id`);--> statement-breakpoint
|
||||
CREATE INDEX `handle_registry_updated_idx` ON `handle_registry` (`updated_at`);--> statement-breakpoint
|
||||
CREATE INDEX `likes_user_post_idx` ON `likes` (`user_id`,`post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `media_user_idx` ON `media` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `media_post_idx` ON `media` (`post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `muted_nodes_user_idx` ON `muted_nodes` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `muted_nodes_domain_idx` ON `muted_nodes` (`node_domain`);--> statement-breakpoint
|
||||
CREATE INDEX `mutes_user_idx` ON `mutes` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `mutes_muted_user_idx` ON `mutes` (`muted_user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `notifications_user_idx` ON `notifications` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `notifications_created_idx` ON `notifications` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_user_id_idx` ON `posts` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_bot_id_idx` ON `posts` (`bot_id`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_created_at_idx` ON `posts` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_reply_to_idx` ON `posts` (`reply_to_id`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_removed_idx` ON `posts` (`is_removed`);--> statement-breakpoint
|
||||
CREATE INDEX `posts_nsfw_idx` ON `posts` (`is_nsfw`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_followers_user_idx` ON `remote_followers` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_followers_actor_idx` ON `remote_followers` (`actor_url`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `remote_followers_user_actor_unique` ON `remote_followers` (`user_id`,`actor_url`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_follows_follower_idx` ON `remote_follows` (`follower_id`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_follows_target_idx` ON `remote_follows` (`target_handle`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_likes_post_idx` ON `remote_likes` (`post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_likes_actor_idx` ON `remote_likes` (`actor_handle`,`actor_node_domain`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `remote_likes_unique` ON `remote_likes` (`post_id`,`actor_handle`,`actor_node_domain`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_posts_author_idx` ON `remote_posts` (`author_handle`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_posts_published_idx` ON `remote_posts` (`published_at`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_posts_ap_id_idx` ON `remote_posts` (`ap_id`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_reposts_post_idx` ON `remote_reposts` (`post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `remote_reposts_actor_idx` ON `remote_reposts` (`actor_handle`,`actor_node_domain`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `remote_reposts_unique` ON `remote_reposts` (`post_id`,`actor_handle`,`actor_node_domain`);--> statement-breakpoint
|
||||
CREATE INDEX `reports_status_idx` ON `reports` (`status`);--> statement-breakpoint
|
||||
CREATE INDEX `reports_target_idx` ON `reports` (`target_type`,`target_id`);--> statement-breakpoint
|
||||
CREATE INDEX `reports_reporter_idx` ON `reports` (`reporter_id`);--> statement-breakpoint
|
||||
CREATE INDEX `sessions_token_idx` ON `sessions` (`token`);--> statement-breakpoint
|
||||
CREATE INDEX `sessions_user_idx` ON `sessions` (`user_id`);--> statement-breakpoint
|
||||
CREATE INDEX `signed_action_dedupe_created_idx` ON `signed_action_dedupe` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_domain_idx` ON `swarm_nodes` (`domain`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_active_idx` ON `swarm_nodes` (`is_active`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_last_seen_idx` ON `swarm_nodes` (`last_seen_at`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_trust_idx` ON `swarm_nodes` (`trust_score`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_nsfw_idx` ON `swarm_nodes` (`is_nsfw`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_nodes_blocked_idx` ON `swarm_nodes` (`is_blocked`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_seeds_enabled_idx` ON `swarm_seeds` (`is_enabled`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_seeds_priority_idx` ON `swarm_seeds` (`priority`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_sync_log_remote_idx` ON `swarm_sync_log` (`remote_domain`);--> statement-breakpoint
|
||||
CREATE INDEX `swarm_sync_log_created_idx` ON `swarm_sync_log` (`created_at`);--> statement-breakpoint
|
||||
CREATE INDEX `user_swarm_likes_user_idx` ON `user_swarm_likes` (`user_id`,`liked_at`);--> statement-breakpoint
|
||||
CREATE INDEX `user_swarm_likes_post_idx` ON `user_swarm_likes` (`node_domain`,`original_post_id`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_swarm_likes_unique` ON `user_swarm_likes` (`user_id`,`node_domain`,`original_post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `user_swarm_reposts_user_idx` ON `user_swarm_reposts` (`user_id`,`reposted_at`);--> statement-breakpoint
|
||||
CREATE INDEX `user_swarm_reposts_post_idx` ON `user_swarm_reposts` (`node_domain`,`original_post_id`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_swarm_reposts_unique` ON `user_swarm_reposts` (`user_id`,`node_domain`,`original_post_id`);--> statement-breakpoint
|
||||
CREATE INDEX `users_handle_idx` ON `users` (`handle`);--> statement-breakpoint
|
||||
CREATE INDEX `users_did_idx` ON `users` (`did`);--> statement-breakpoint
|
||||
CREATE INDEX `users_suspended_idx` ON `users` (`is_suspended`);--> statement-breakpoint
|
||||
CREATE INDEX `users_silenced_idx` ON `users` (`is_silenced`);--> statement-breakpoint
|
||||
CREATE INDEX `users_is_bot_idx` ON `users` (`is_bot`);--> statement-breakpoint
|
||||
CREATE INDEX `users_bot_owner_idx` ON `users` (`bot_owner_id`);--> statement-breakpoint
|
||||
CREATE INDEX `users_nsfw_idx` ON `users` (`is_nsfw`);
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,104 +0,0 @@
|
||||
{
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "7",
|
||||
"when": 1769153858323,
|
||||
"tag": "0000_clumsy_donald_blake",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "7",
|
||||
"when": 1769153858324,
|
||||
"tag": "0004_add_source_config",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "7",
|
||||
"when": 1769367465905,
|
||||
"tag": "0002_add_logo_url",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1769370833410,
|
||||
"tag": "0003_small_reavers",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1769377790354,
|
||||
"tag": "0004_luxuriant_lockheed",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 5,
|
||||
"version": "7",
|
||||
"when": 1769422771465,
|
||||
"tag": "0005_yummy_millenium_guard",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 6,
|
||||
"version": "7",
|
||||
"when": 1769427398729,
|
||||
"tag": "0006_loud_moonstone",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 7,
|
||||
"version": "7",
|
||||
"when": 1769446756226,
|
||||
"tag": "0007_kind_agent_zero",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 8,
|
||||
"version": "7",
|
||||
"when": 1769453302714,
|
||||
"tag": "0008_illegal_carlie_cooper",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 9,
|
||||
"version": "7",
|
||||
"when": 1769562092857,
|
||||
"tag": "0009_sweet_chat",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 10,
|
||||
"version": "7",
|
||||
"when": 1769579537338,
|
||||
"tag": "0010_add_sender_did_to_chat_messages",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 11,
|
||||
"version": "7",
|
||||
"when": 1769586658154,
|
||||
"tag": "0011_elite_kat_farrell",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 12,
|
||||
"version": "7",
|
||||
"when": 1769586699065,
|
||||
"tag": "0012_quick_mockingbird",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 13,
|
||||
"version": "7",
|
||||
"when": 1769638500000,
|
||||
"tag": "0013_add_storage_public_base_url",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user