g1t/services/billing/migrations/0015_sandbox_at_cost.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.
| Prices are what g1t pays plus 20%, from the first second | 1 | -- Sandbox time is charged at cost plus 20% from the first second, like |
| 2 | -- everything else in the price book. There are no free minutes, so the | |
| 3 | -- monthly count that measured them goes. | |
| 4 | ||
| 5 | -- A change can be to the markup rather than to the cost: what it was. | |
| 6 | ALTER TABLE price_changes ADD COLUMN old_markup_percent INTEGER; | |
| 7 | ||
| 8 | INSERT INTO price_changes (id, meter, old_cost_micros, new_cost_micros, markup_percent, old_markup_percent, reason, created_at) | |
| 9 | SELECT 'prc_sandbox_at_cost', meter, cost_micros, cost_micros, 20, markup_percent, | |
| 10 | 'Sandbox time is now charged at cost plus 20% from the first second', | |
| 11 | strftime('%Y-%m-%dT%H:%M:%SZ', 'now') | |
| 12 | FROM prices WHERE meter = 'sandbox_second' AND markup_percent <> 20; | |
| 13 | ||
| 14 | UPDATE prices SET markup_percent = 20, updated_at = strftime('%Y-%m-%dT%H:%M:%SZ', 'now') | |
| 15 | WHERE meter = 'sandbox_second'; | |
| 16 | ||
| 17 | DROP TABLE IF EXISTS sandbox_months; |