🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2022-09-09 22:51:10.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2022-09-09 22:51:10.0 +01:00:00
commit
9ebf55ebc7d3a264b5b5ab7f2c820cbac5ac5ff6 [patch]
tree
dc4cc8782719a7acf67fb4ff2198c901f8d2b233
parent
ec84c1dbc32507246104db20f0cf6c34767dae2f
download
9ebf55ebc7d3a264b5b5ab7f2c820cbac5ac5ff6.tar.gz

Fix CASE statements to use SQL standard syntax



Diff

 chartered-db/src/crates.rs        | 2 +-
 chartered-db/src/organisations.rs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chartered-db/src/crates.rs b/chartered-db/src/crates.rs
index 8076c7a..b89a660 100644
--- a/chartered-db/src/crates.rs
+++ a/chartered-db/src/crates.rs
@@ -91,7 +91,7 @@
            0,
        ))
        .bitwise_or(diesel::dsl::sql::<diesel::sql_types::Integer>(&format!(
            "COALESCE(CASE WHEN {} THEN {} OR 0 END, 0)",
            "COALESCE(CASE WHEN {} THEN {} ELSE 0 END, 0)",
            "organisations.public",
            UserPermission::VISIBLE.bits(),
        )))
diff --git a/chartered-db/src/organisations.rs b/chartered-db/src/organisations.rs
index b4495b8..728eb7e 100644
--- a/chartered-db/src/organisations.rs
+++ a/chartered-db/src/organisations.rs
@@ -20,7 +20,7 @@
            0,
        )
        .bitwise_or(diesel::dsl::sql::<diesel::sql_types::Integer>(&format!(
            "COALESCE(CASE WHEN {} THEN {} OR 0 END, 0)",
            "COALESCE(CASE WHEN {} THEN {} ELSE 0 END, 0)",
            "public",
            UserPermission::VISIBLE.bits(),
        )))