Skip to content

Commit

Permalink
Rebase on our old friend main
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Oct 25, 2024
1 parent c74998f commit 14fd6eb
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1,812 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,25 @@ pub struct CheckArgument {
pub fn default_constraint() -> serde_json::Value {
serde_json::json!({"type": "and", "expressions": []})
}

// the old default was to prefix generated mutations with `v2_` or `v1_`
// but now we are able to override this
pub fn get_version_prefix(mutations_prefix: &Option<String>) -> String {
match mutations_prefix {
None => format!("{}_", super::VERSION),
Some(str) => match str.as_str() {
"" => String::new(),
_ => format!("{str}_"),
},
}
}

#[test]
fn test_version_prefix() {
assert_eq!(get_version_prefix(&None), "v2_".to_string());
assert_eq!(
get_version_prefix(&Some("horse".into())),
"horse_".to_string()
);
assert_eq!(get_version_prefix(&Some("".into())), "".to_string());
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Auto-generate delete mutations and translate them into sql ast.

use super::common::{self, CheckArgument};
use crate::translation::error::Error;
use crate::translation::helpers::{self, TableSourceAndReference};
use crate::translation::query::filtering;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use query_engine_metadata::metadata::database;
use query_engine_sql::sql;
use std::collections::{BTreeMap, BTreeSet};

use super::common::{default_constraint, CheckArgument};
use super::common::{self, default_constraint, CheckArgument};

/// A representation of an auto-generated insert mutation.
///
Expand Down
Loading

0 comments on commit 14fd6eb

Please sign in to comment.