Add cost history to the Costs page: what it cost each month, and what changed
Each cost item's name, amount, currency, period and kind are kept as versions (cost_item_versions), and Hetzner's estimate is written down once a day (cost_snapshots), so a past month's figure and the changes between can be worked out. History card with monthly bars per currency, month-by-month figures and a list of added, changed and removed items. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b29c0b7d04
commit
9f366c37de
15 files changed
+9716
-3
No files matched your search
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE `cost_item_versions` (
|
||||
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`item_id` integer NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`amount` real NOT NULL,
|
||||
`currency` text NOT NULL,
|
||||
`period` text NOT NULL,
|
||||
`category` text NOT NULL,
|
||||
`valid_from` text NOT NULL,
|
||||
`valid_to` text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX `cost_item_versions_item_idx` ON `cost_item_versions` (`item_id`);--> statement-breakpoint
|
||||
CREATE TABLE `cost_snapshots` (
|
||||
`day` text NOT NULL,
|
||||
`key` text NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`currency` text NOT NULL,
|
||||
`monthly` real NOT NULL,
|
||||
PRIMARY KEY(`day`, `key`)
|
||||
);
|
||||
Reference in new issue
Block a user