CREATE TABLE "planning_sessions" (
	"id" text PRIMARY KEY NOT NULL,
	"project_id" text NOT NULL,
	"plan_id" text NOT NULL,
	"plan_revision_id" text,
	"project_vision_version_id" text,
	"goal_ids" jsonb DEFAULT '[]'::jsonb NOT NULL,
	"intent" text NOT NULL,
	"mode" text DEFAULT 'simple' NOT NULL,
	"profile" jsonb NOT NULL,
	"status" text DEFAULT 'active' NOT NULL,
	"readiness" text DEFAULT 'blocked' NOT NULL,
	"active_item_key" text,
	"draft" text DEFAULT '' NOT NULL,
	"items" jsonb DEFAULT '[]'::jsonb NOT NULL,
	"deferrals" jsonb DEFAULT '[]'::jsonb NOT NULL,
	"delivery" jsonb NOT NULL,
	"launch" jsonb,
	"revision" integer DEFAULT 1 NOT NULL,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL,
	"updated_at" timestamp with time zone NOT NULL
);
--> statement-breakpoint
CREATE TABLE "project_planning_defaults" (
	"project_id" text PRIMARY KEY NOT NULL,
	"mode" text DEFAULT 'simple' NOT NULL,
	"profile_kind" text NOT NULL,
	"delivery" jsonb NOT NULL,
	"accepted_decision_answers" jsonb DEFAULT '{}'::jsonb NOT NULL,
	"revision" integer DEFAULT 1 NOT NULL,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "goals" ADD COLUMN "readiness" text DEFAULT 'not-ready' NOT NULL;--> statement-breakpoint
ALTER TABLE "goals" ADD COLUMN "readiness_reason" text;