-- Current sql file was generated after introspecting the database
-- If you want to run this migration please uncomment this code before executing migrations
/*
CREATE TABLE "comment" (
	"id" uuid PRIMARY KEY NOT NULL,
	"content" text,
	"created_at" date,
	"is_deleted" boolean DEFAULT false,
	"writer_id" uuid,
	"parent_id" uuid
);
--> statement-breakpoint
CREATE TABLE "schedule" (
	"id" uuid PRIMARY KEY NOT NULL,
	"name" varchar,
	"start_at" date,
	"end_at" date,
	"status" varchar,
	"content" text,
	"is_deleted" boolean DEFAULT false,
	"type" varchar,
	"created_at" date,
	"owner" uuid
);
--> statement-breakpoint
CREATE TABLE "account" (
	"name" varchar NOT NULL,
	"email" varchar NOT NULL,
	"password" varchar NOT NULL,
	"birthday" date,
	"account_id" varchar NOT NULL,
	"nickname" varchar NOT NULL,
	"status" varchar DEFAULT 'wait' NOT NULL,
	"is_deleted" boolean DEFAULT false NOT NULL,
	"created_at" date DEFAULT now() NOT NULL,
	"id" uuid PRIMARY KEY DEFAULT uuid_generate_v4() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "participant" (
	"participant_id" uuid NOT NULL,
	"schedule_id" uuid NOT NULL,
	"is_deleted" boolean DEFAULT false
);
--> statement-breakpoint
CREATE TABLE "favorite" (
	"is_deleted" boolean DEFAULT false,
	"created_at" date,
	"user_id" uuid NOT NULL,
	"schedule_id" uuid NOT NULL,
	CONSTRAINT "favorite_pk" PRIMARY KEY("user_id","schedule_id")
);
--> statement-breakpoint
CREATE TABLE "follow" (
	"is_deleted" boolean DEFAULT false,
	"is_accepted" boolean DEFAULT false,
	"is_linked" boolean DEFAULT false,
	"created_at" date,
	"following" uuid NOT NULL,
	"follower" uuid NOT NULL,
	CONSTRAINT "follow_pk" PRIMARY KEY("following","follower")
);
--> statement-breakpoint
ALTER TABLE "comment" ADD CONSTRAINT "writer_id" FOREIGN KEY ("writer_id") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "comment" ADD CONSTRAINT "parent_id" FOREIGN KEY ("parent_id") REFERENCES "public"."comment"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "schedule" ADD CONSTRAINT "schedule_user_fk" FOREIGN KEY ("owner") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "participant" ADD CONSTRAINT "schedule_id" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedule"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "participant" ADD CONSTRAINT "participant_id" FOREIGN KEY ("participant_id") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "favorite" ADD CONSTRAINT "schedule_id" FOREIGN KEY ("schedule_id") REFERENCES "public"."schedule"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "favorite" ADD CONSTRAINT "user_id" FOREIGN KEY ("user_id") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "follow" ADD CONSTRAINT "follower_id" FOREIGN KEY ("follower") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "follow" ADD CONSTRAINT "following_id" FOREIGN KEY ("following") REFERENCES "public"."account"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "schedule_enddatetime_idx" ON "schedule" USING btree ("end_at" date_ops);--> statement-breakpoint
CREATE INDEX "schedule_name_idx" ON "schedule" USING btree ("name" text_ops,"content" text_ops);--> statement-breakpoint
CREATE INDEX "schedule_startdatetime_idx" ON "schedule" USING btree ("start_at" date_ops);--> statement-breakpoint
CREATE INDEX "schedule_status_idx" ON "schedule" USING btree ("status" text_ops);--> statement-breakpoint
CREATE INDEX "schedule_type_idx" ON "schedule" USING btree ("type" text_ops);--> statement-breakpoint
CREATE INDEX "participant_participant_id_idx" ON "participant" USING btree ("participant_id" uuid_ops);--> statement-breakpoint
CREATE INDEX "participant_schedule_id_idx" ON "participant" USING btree ("schedule_id" uuid_ops);
*/