flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/services/actions/src/rename.rs

22 lines802 bytesCodeBlame
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.
5pub const STATEMENTS: &[&str] = &[
6 "UPDATE settings SET owner = ?1 WHERE scope = 'workspace' AND owner = ?2",
7 "UPDATE jobs SET namespace = ?1 WHERE namespace = ?2",
8 "UPDATE workflows SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'",
9 "UPDATE runs SET repo = ?1 || substr(repo, length(?2) + 1) WHERE substr(repo, 1, length(?2) + 1) = ?2 || '/'",
10];
11
12#[cfg(test)]
13mod tests {
14 use super::STATEMENTS;
15
16 #[test]
17 fn every_statement_takes_the_two_slugs() {
18 for sql in STATEMENTS {
19 assert_eq!(g1t_kit::rename::parameters(sql), 2, "{sql}");
20 }
21 }
22}