Tasks goals: auto metrics (tasks.goals.metric_key/metric_detail/metric_computed_at, tasks.metric_sources cache). €10k/month goal gets a live progress bar: Revolut recurring income (excl. Zorgtoeslag/Joint) computed on page load + trailing-12m paid Moneybird invoices / 12 cached by a daily goal-metrics user timer; stacked bar with %, amount vs target, salary/side-income breakdown, last-updated
Some checks failed
Deploy production / deploy (push) Failing after 1m14s
Some checks failed
Deploy production / deploy (push) Failing after 1m14s
This commit is contained in:
23
drizzle/20261026011600_goal_metrics/migration.sql
Normal file
23
drizzle/20261026011600_goal_metrics/migration.sql
Normal file
@@ -0,0 +1,23 @@
|
||||
CREATE TABLE "tasks"."metric_sources" (
|
||||
"key" text PRIMARY KEY,
|
||||
"value" numeric(14,2),
|
||||
"detail" jsonb,
|
||||
"computed_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"attempted_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
"error" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_key" text;--> statement-breakpoint
|
||||
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_detail" jsonb;--> statement-breakpoint
|
||||
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_computed_at" timestamp with time zone;--> statement-breakpoint
|
||||
-- Grants (default privileges already cover new tasks tables; explicit for safety). Prod only.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF current_user = 'personal' AND EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_app') THEN
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON tasks.metric_sources TO personal_app;
|
||||
END IF;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
-- Stan's income goal gets the auto metric (salary from money.recurring + Moneybird side income).
|
||||
UPDATE tasks.goals SET metric_key = 'own-net-income-monthly'
|
||||
WHERE metric_key IS NULL AND title ILIKE '€10k net/month into own Revolut%';
|
||||
40016
drizzle/20261026011600_goal_metrics/snapshot.json
Normal file
40016
drizzle/20261026011600_goal_metrics/snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user