feat(CC-066): add action_plans and scenarios tables (migration 0012)

This commit is contained in:
admin-valentin 2026-08-02 12:09:00 +00:00
parent 972a0f6f9d
commit 641c68ed91

View file

@ -0,0 +1,36 @@
-- CC-066: action_plans + scenarios
CREATE TABLE IF NOT EXISTS "action_plans" (
"id" uuid DEFAULT gen_random_uuid() PRIMARY KEY NOT NULL,
"tenant_id" uuid NOT NULL,
"workspace_id" uuid,
"title" text NOT NULL,
"description" text,
"status" text DEFAULT 'draft' NOT NULL,
"priority" text DEFAULT 'medium' NOT NULL,
"owner" text,
"due_date" date,
"completed_at" timestamp,
"decision_id" uuid,
"goal_id" uuid,
"project_id" uuid,
"tags" text[] DEFAULT '{}' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"deleted_at" timestamp
);
CREATE TABLE IF NOT EXISTS "scenarios" (
"id" uuid DEFAULT gen_random_uuid() PRIMARY KEY NOT NULL,
"tenant_id" uuid NOT NULL,
"decision_id" uuid,
"title" text NOT NULL,
"description" text,
"probability" text DEFAULT 'medium' NOT NULL,
"outcome" text,
"financial_impact_minor_units" numeric(15,0),
"financial_impact_currency" text DEFAULT 'RON' NOT NULL,
"impact_direction" text DEFAULT 'neutral' NOT NULL,
"status" text DEFAULT 'hypothetical' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);