CREATE TABLE "post_related" (
	"post_id" uuid,
	"related_id" uuid,
	CONSTRAINT "post_related_post_id_related_id_pk" PRIMARY KEY("post_id","related_id")
);
--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "topic" SET DATA TYPE varchar(45);--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "topic" DROP DEFAULT;--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "title" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "status" SET DATA TYPE varchar(20);--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "status" DROP DEFAULT;--> statement-breakpoint
ALTER TABLE "post_related" ADD CONSTRAINT "post_related_post_id_posts_id_fk" FOREIGN KEY ("post_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "post_related" ADD CONSTRAINT "post_related_related_id_posts_id_fk" FOREIGN KEY ("related_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;