g1t/services/billing/migrations/0031_package_storage.sql
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 1 | -- What each workspace's packages held each day (services/packages), public |
| 2 | -- and private, each file counted once, and what was free that day. | |
| 3 | CREATE TABLE package_storage_days ( | |
| 4 | workspace TEXT NOT NULL, | |
| 5 | -- YYYY-MM-DD. | |
| 6 | day TEXT NOT NULL, | |
| 7 | public_bytes INTEGER NOT NULL, | |
| 8 | private_bytes INTEGER NOT NULL, | |
| 9 | public_free_bytes INTEGER NOT NULL, | |
| 10 | private_free_bytes INTEGER NOT NULL, | |
| 11 | PRIMARY KEY (workspace, day) | |
| 12 | ); | |
| 13 | ||
| 14 | -- Package storage past the free amounts, at R2's storage price ($0.015 a | |
| 15 | -- GB-month); downloads cost nothing (R2 has no egress fees). | |
| 16 | INSERT INTO prices (meter, title, unit, cost_micros, markup_percent, source, updated_at) VALUES | |
| 17 | ('package_storage', 'Package storage past the free amounts', 'GB-month', 15000, 20, 'list', '2026-10-06T00:00:00Z') | |
| 18 | ON CONFLICT (meter) DO NOTHING; | |
| 19 | ||
| 20 | INSERT INTO price_changes (id, meter, old_cost_micros, new_cost_micros, markup_percent, reason, created_at) VALUES | |
| 21 | ('prc_new_package_storage', 'package_storage', 15000, 15000, 20, 'Now metered: package storage past the free amounts, at R2''s storage price', '2026-10-06T00:00:00Z') | |
| 22 | ON CONFLICT (id) DO NOTHING; |