CREATE TABLE "month_status" (
	"id" text PRIMARY KEY NOT NULL,
	"household_id" text NOT NULL,
	"month" text NOT NULL,
	"status" text DEFAULT 'open' NOT NULL,
	"closed_at" timestamp,
	"closed_by" text,
	"final_amount" numeric(12, 2),
	"notes" text,
	"final_transfer_id" text,
	"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "month_status" ADD CONSTRAINT "month_status_household_id_households_id_fk" FOREIGN KEY ("household_id") REFERENCES "public"."households"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "month_status" ADD CONSTRAINT "month_status_closed_by_user_id_fk" FOREIGN KEY ("closed_by") REFERENCES "public"."user"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "month_status_household_id_idx" ON "month_status" USING btree ("household_id");--> statement-breakpoint
CREATE INDEX "month_status_month_idx" ON "month_status" USING btree ("month");