ALTER TABLE "post_related" RENAME COLUMN "post_id" TO "project_id";--> statement-breakpoint
ALTER TABLE "post_related" DROP CONSTRAINT "post_related_post_id_posts_id_fk";
--> statement-breakpoint
ALTER TABLE "post_related" DROP CONSTRAINT "post_related_post_id_related_id_pk";--> statement-breakpoint
ALTER TABLE "post_related" ADD CONSTRAINT "post_related_project_id_related_id_pk" PRIMARY KEY("project_id","related_id");--> statement-breakpoint
ALTER TABLE "post_related" ADD CONSTRAINT "post_related_project_id_posts_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."posts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "post_related" RENAME COLUMN "related_id" TO "post_id";--> statement-breakpoint
ALTER TABLE "post_related" DROP CONSTRAINT "post_related_related_id_posts_id_fk";
--> statement-breakpoint
ALTER TABLE "post_related" DROP CONSTRAINT "post_related_project_id_related_id_pk";--> statement-breakpoint
ALTER TABLE "post_related" ADD CONSTRAINT "post_related_project_id_post_id_pk" PRIMARY KEY("project_id","post_id");--> 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;