g1t/services/actions/migrations/0003_settings_access.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.
| Secrets and variables: one list, rows per environment, for workflows and deployments | 1 | -- Secrets and variables become one list, as Vercel's environment variables |
| 2 | -- are: each row is a key, its type (secret or config), the environments it | |
| 3 | -- applies to and who reads it. A key may have one row per environment, so | |
| 4 | -- the unique (owner, kind, name) constraint goes; the service keeps a | |
| Secrets and variables kept from before stay with workflows | 5 | -- key's rows from overlapping. Existing rows keep working exactly as before: |
| 6 | -- every environment, read by workflows alone, so nothing reaches | |
| 7 | -- deployments until someone says it should. | |
| Secrets and variables: one list, rows per environment, for workflows and deployments | 8 | |
| 9 | CREATE TABLE settings_v2 ( | |
| 10 | id TEXT PRIMARY KEY, | |
| 11 | -- repository or workspace. | |
| 12 | scope TEXT NOT NULL, | |
| 13 | -- The repository's id, or the workspace's slug. | |
| 14 | owner TEXT NOT NULL, | |
| 15 | -- secret or variable (shown as Config). A variable may become a secret; | |
| 16 | -- a secret never becomes a variable. | |
| 17 | kind TEXT NOT NULL, | |
| 18 | name TEXT NOT NULL, | |
| 19 | -- A secret's is sealed, bound to the row's id. | |
| 20 | value TEXT NOT NULL, | |
| 21 | updated_at TEXT NOT NULL, | |
| 22 | -- workflows and deployments, comma-separated. | |
| 23 | available_to TEXT NOT NULL DEFAULT 'workflows,deployments', | |
| 24 | -- The environments it applies to, comma-separated (production, preview, | |
| 25 | -- or a workflow job's `environment:`). Empty is every environment. | |
| 26 | environments TEXT NOT NULL DEFAULT '', | |
| 27 | -- A workspace's row: the repositories it reaches, as a JSON array of | |
| 28 | -- names. Null is every repository. | |
| 29 | repositories TEXT, | |
| 30 | -- Where to rotate it, or who to ask. | |
| 31 | note TEXT, | |
| 32 | updated_by TEXT | |
| 33 | ); | |
| 34 | ||
| Secrets and variables kept from before stay with workflows | 35 | INSERT INTO settings_v2 (id, scope, owner, kind, name, value, updated_at, available_to) |
| 36 | SELECT id, scope, owner, kind, name, value, updated_at, 'workflows' FROM settings; | |
| Secrets and variables: one list, rows per environment, for workflows and deployments | 37 | DROP TABLE settings; |
| 38 | ALTER TABLE settings_v2 RENAME TO settings; | |
| 39 | CREATE INDEX settings_by_owner ON settings (owner, name); |