# Notion Schema

Use your Projects or Products database as the thing being billed against.

Tasks should sit between Projects/Products and Time Entries:

`Project/Product → Tasks → Time Entries`

That lets one task have many time entries.

You can also keep a direct Time Entry → Project/Product relation for easy filtering, but the important relation is Time Entry → Task.

## Tasks Table

Your Tasks database needs:

| Property | Type | Default name |
| --- | --- | --- |
| Task name | Title | `Name` |
| Project/Product | Relation | `Project` |

## Time Entries Table

| Property | Type | Default name |
| --- | --- | --- |
| Time entry title | Title | `Entry` |
| Description | Text | `Description` |
| Task | Relation | `Task` |
| Project/Product | Relation | `Project` |
| Started at | Date | `Started At` |
| Ended at | Date | `Ended At` |
| Actual minutes | Number | `Actual Minutes` |
| Rounded minutes | Number | `Rounded Minutes` |
| Rounding delta | Number | `Rounding Delta` |

## Projects/Products Rollups

Best rollup path:

1. Roll time totals from Time Entries up to Tasks.
2. Roll task totals up to Projects/Products.

On Tasks, add:

| Property | Type | Source |
| --- | --- | --- |
| Time Entries | Relation | Related Time Entries |
| Actual Time Total | Rollup | Sum of Time Entries `Actual Minutes` |
| Billable Time Total | Rollup | Sum of Time Entries `Rounded Minutes` |

On Projects/Products, add:

| Property | Type | Source |
| --- | --- | --- |
| Tasks | Relation | Related Tasks |
| Actual Time Total | Rollup | Sum of Tasks `Actual Time Total` |
| Billable Time Total | Rollup | Sum of Tasks `Billable Time Total` |

This keeps Time sortable, Task totals visible, and Project/Product totals accurate.
