CREATE TABLE "tweet_media_analyzer" (
	"id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "tweet_media_analyzer_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
	"tweet_id" integer NOT NULL,
	"url" text NOT NULL,
	"type" text NOT NULL,
	"description" text,
	"scraped_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "tweets_analyzer" (
	"id" integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (sequence name "tweets_analyzer_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1),
	"api_id" text NOT NULL,
	"url" text NOT NULL,
	"text" text NOT NULL,
	"retweet_count" integer DEFAULT 0 NOT NULL,
	"reply_count" integer DEFAULT 0 NOT NULL,
	"like_count" integer DEFAULT 0 NOT NULL,
	"quote_count" integer DEFAULT 0 NOT NULL,
	"view_count" integer DEFAULT 0 NOT NULL,
	"bookmark_count" integer DEFAULT 0 NOT NULL,
	"username" text NOT NULL,
	"created_at" timestamp NOT NULL,
	"evs" real DEFAULT 0 NOT NULL,
	"scraped_at" timestamp DEFAULT now() NOT NULL,
	"status" text DEFAULT 'scraped' NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL,
	CONSTRAINT "tweets_analyzer_api_id_unique" UNIQUE("api_id")
);
--> statement-breakpoint
ALTER TABLE "tweet_media_analyzer" ADD CONSTRAINT "tweet_media_analyzer_tweet_id_tweets_analyzer_id_fk" FOREIGN KEY ("tweet_id") REFERENCES "public"."tweets_analyzer"("id") ON DELETE cascade ON UPDATE no action;