CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
0052_playground_accounts.sql
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| cd4f63b | 1 | -- Block Q3 — Anonymous playground accounts. |
| 2 | -- | |
| 3 | -- Strictly additive. Two nullable columns on `users`: | |
| 4 | -- * is_playground — discriminator. Default false. | |
| 5 | -- * playground_expires_at — TTL. Default null. NOT NULL only when | |
| 6 | -- is_playground = true (enforced in lib code, | |
| 7 | -- not in SQL, so the column stays nullable for | |
| 8 | -- the 99.9% of real users that never play). | |
| 9 | -- | |
| 10 | -- A partial index keeps the autopilot purge sweep cheap: only playground | |
| 11 | -- rows are indexed, and the index is ordered by expiry so the | |
| 12 | -- `expires_at < now()` scan is a small left-prefix range read. | |
| 13 | ||
| 14 | ALTER TABLE users | |
| 15 | ADD COLUMN IF NOT EXISTS is_playground boolean NOT NULL DEFAULT false, | |
| 16 | ADD COLUMN IF NOT EXISTS playground_expires_at timestamptz; | |
| 17 | ||
| 18 | CREATE INDEX IF NOT EXISTS idx_users_playground_expires | |
| 19 | ON users (playground_expires_at) | |
| 20 | WHERE is_playground = true; |