36 lines
1.5 KiB
SQL
36 lines
1.5 KiB
SQL
-- 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
|
|
);
|