g1t/services/billing/migrations/0003_subscriptions.sql
| 1 | -- Paid features a workspace turns on with a monthly plan (deployments). |
| 2 | -- Never free: FREE_WHILE_BUILDING does not cover them. |
| 3 | |
| 4 | CREATE TABLE subscriptions ( |
| 5 | workspace TEXT NOT NULL, |
| 6 | -- deployments. |
| 7 | feature TEXT NOT NULL, |
| 8 | -- The payment provider's subscription. |
| 9 | subscription_id TEXT NOT NULL, |
| 10 | -- active, canceling, past_due or canceled. |
| 11 | status TEXT NOT NULL, |
| 12 | -- When the period paid for ends; the plan is asked about again after. |
| 13 | period_end TEXT, |
| 14 | started_by TEXT NOT NULL, |
| 15 | started_at TEXT NOT NULL, |
| 16 | updated_at TEXT NOT NULL, |
| 17 | PRIMARY KEY (workspace, feature) |
| 18 | ); |
| 19 | |
| 20 | -- A card page for a plan rather than for credit. |
| 21 | ALTER TABLE checkouts ADD COLUMN feature TEXT; |