| 1 | -- What a workspace had metered this month when its test-mode Stripe data |
| 2 | -- was detached (`admin_detach_test_stripe`, src/detach.rs). Reporters |
| 3 | -- replace a month's pending_usage row with the month's whole figure, so |
| 4 | -- the usage from before the detach cannot be marked charged on its own: |
| 5 | -- everything that values or charges pending usage takes this off the |
| 6 | -- row's figure, never below nothing (`storage::NET_COST`, `NET_CHARGE`). |
| 7 | -- Months before the detach have their rows marked charged instead. |
| 8 | CREATE TABLE IF NOT EXISTS pending_baselines ( |
| 9 | workspace TEXT NOT NULL, |
| 10 | source TEXT NOT NULL, |
| 11 | -- YYYY-MM. |
| 12 | month TEXT NOT NULL, |
| 13 | -- The row's cost_micros and charge_micros when it was detached. |
| 14 | cost_micros INTEGER NOT NULL DEFAULT 0, |
| 15 | charge_micros INTEGER NOT NULL DEFAULT 0, |
| 16 | created_at TEXT NOT NULL, |
| 17 | PRIMARY KEY (workspace, source, month) |
| 18 | ); |