From f3278d82648c1aa585164447ac2fb78d34a3d2b3 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Sun, 2 Aug 2026 12:09:03 +0000 Subject: [PATCH] feat(CC-066): add actionPlans + scenarios to schema --- src/db/schema.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/db/schema.ts b/src/db/schema.ts index 6c8c3da..2ef2766 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -787,3 +787,40 @@ export const pipelineDeals = pgTable('pipeline_deals', { updatedAt: timestamp('updated_at').defaultNow().notNull(), deletedAt: timestamp('deleted_at'), }); + +// ——— CC-066 ——— +export const actionPlans = pgTable('action_plans', { + id: uuid('id').defaultRandom().primaryKey().notNull(), + tenantId: uuid('tenant_id').notNull(), + workspaceId: uuid('workspace_id'), + title: text('title').notNull(), + description: text('description'), + status: text('status').default('draft').notNull(), + priority: text('priority').default('medium').notNull(), + owner: text('owner'), + dueDate: date('due_date'), + completedAt: timestamp('completed_at'), + decisionId: uuid('decision_id'), + goalId: uuid('goal_id'), + projectId: uuid('project_id'), + tags: text('tags').array().default([]).notNull(), + createdAt: timestamp('created_at').defaultNow().notNull(), + updatedAt: timestamp('updated_at').defaultNow().notNull(), + deletedAt: timestamp('deleted_at'), +}); + +export const scenarios = pgTable('scenarios', { + id: uuid('id').defaultRandom().primaryKey().notNull(), + tenantId: uuid('tenant_id').notNull(), + decisionId: uuid('decision_id'), + title: text('title').notNull(), + description: text('description'), + probability: text('probability').default('medium').notNull(), + outcome: text('outcome'), + financialImpactMinorUnits: numeric('financial_impact_minor_units', { precision: 15, scale: 0 }), + financialImpactCurrency: text('financial_impact_currency').default('RON').notNull(), + impactDirection: text('impact_direction').default('neutral').notNull(), + status: text('status').default('hypothetical').notNull(), + createdAt: timestamp('created_at').defaultNow().notNull(), + updatedAt: timestamp('updated_at').defaultNow().notNull(), +});