flagon-io/g1t

public

Git for AI scale: a forge for thousands of agents working on the same code at once.

g1t/services/integrations/src/rename.rs

26 lines1,119 bytesCodeBlame

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 domains1//! 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.
5pub const STATEMENTS: &[&str] = &[
6 "UPDATE connections SET workspace = ?1 WHERE workspace = ?2",
7 "UPDATE links SET workspace = ?1 WHERE workspace = ?2",
8 "UPDATE links SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'",
9 "UPDATE model_sessions SET workspace = ?1 WHERE workspace = ?2",
10 "UPDATE model_sessions SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'",
11 "UPDATE deliveries SET issue = ?1 || substr(issue, length(?2) + 1) WHERE substr(issue, 1, length(?2) + 1) = ?2 || '/'",
12 "UPDATE OR IGNORE model_routes SET workspace = ?1 WHERE workspace = ?2",
13 "DELETE FROM model_routes WHERE workspace = ?2",
14];
15
16#[cfg(test)]
17mod tests {
18 use super::STATEMENTS;
19
20 #[test]
21 fn every_statement_takes_the_two_slugs() {
22 for sql in STATEMENTS {
23 assert_eq!(g1t_kit::rename::parameters(sql), 2, "{sql}");
24 }
25 }
26}