g1t/services/projects/migrations/0005_description_inherits.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.
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 1 | -- A project's description follows its repository's until someone gives the |
| 2 | -- project one of its own. `description` now holds only that own text (null: | |
| 3 | -- follow the repository); `repo_description` is the repository's, kept from | |
| 4 | -- repos like its visibility and default branch. | |
| 5 | ALTER TABLE projects ADD COLUMN repo_description TEXT; | |
| 6 | ||
| 7 | -- Primary projects were made from their repository (from repo.created or a | |
| 8 | -- backfill) with its description copied in. Whether a person later edited | |
| 9 | -- that copy is not recorded: settings saved the description field with every | |
| 10 | -- change of name or root directory, so updated_at does not tell. Every | |
| 11 | -- primary project follows its repository from here; its copy seeds | |
| 12 | -- repo_description until the backfill below reads the repository's current | |
| 13 | -- one. Other projects were made by a person, who gave their description: | |
| 14 | -- theirs stays their own. | |
| 15 | UPDATE projects SET repo_description = description, description = NULL WHERE is_primary = 1; | |
| 16 | ||
| 17 | -- Every workspace's projects are read from repos once more, on their next | |
| 18 | -- listing, so repo_description is the repository's description as it is now. | |
| 19 | DELETE FROM backfilled; |