g1t/services/webhooks/src/rename.rs
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.
| Agents and memory, checks and conflicts, profiles, slug renames, custom domains | 1 | //! A workspace renamed: rows kept under its old slug move to the one it |
| 2 | //! has now. See `g1t_kit::rename`. | |
| 3 | ||
| 4 | /// `?1` is the current slug, `?2` a stale one. | |
| 5 | pub const STATEMENTS: &[&str] = &[ | |
| 6 | "UPDATE hooks SET workspace = ?1 WHERE workspace = ?2", | |
| 7 | "UPDATE hooks SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'", | |
| 8 | "UPDATE repo_names SET namespace = ?1 WHERE namespace = ?2", | |
| 9 | ]; | |
| 10 | ||
| 11 | #[cfg(test)] | |
| 12 | mod tests { | |
| 13 | use super::STATEMENTS; | |
| 14 | ||
| 15 | #[test] | |
| 16 | fn every_statement_takes_the_two_slugs() { | |
| 17 | for sql in STATEMENTS { | |
| 18 | assert_eq!(g1t_kit::rename::parameters(sql), 2, "{sql}"); | |
| 19 | } | |
| 20 | } | |
| 21 | } |