Skip to content

Commit

Permalink
Merge pull request #11 from nlopes/nlopes-bump-to-0.2.0
Browse files Browse the repository at this point in the history
Bump to 0.2.0
  • Loading branch information
nlopes authored Jan 18, 2024
2 parents d72e264 + e084131 commit c3b7135
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,13 @@ jobs:
run: rustup run ${{ matrix.toolchain }} cargo test --features sqlite,sqlx,runtime-async-std,macros --doc --verbose

- name: Run clippy
run: rustup run ${{ matrix.toolchain }} cargo clippy --features sqlite,sqlx,runtime-async-std,macros -- -Dwarnings

run: |
rustup run ${{ matrix.toolchain }} cargo clippy --features sqlite,sqlx,runtime-async-std,macros --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features postgres,sqlx,runtime-async-std,macros --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features mysql,sqlx,runtime-async-std,macros --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features sqlite,diesel --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features postgres,diesel --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features mysql,diesel --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features sqlite,diesel,runtime-async-std,macros --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features postgres,diesel,runtime-async-std,macros --all-targets -- -Dwarnings
rustup run ${{ matrix.toolchain }} cargo clippy --features mysql,diesel,runtime-async-std,macros --all-targets -- -Dwarnings
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "database-schema"
version = "0.1.2"
version = "0.2.0"
edition = "2021"
description = "A library to dump a database schema into a file in SQL format"
documentation = "https://docs.rs/database-schema"
Expand Down Expand Up @@ -42,7 +42,7 @@ sqlx = { version = "0.7", features = ["migrate", "macros"], optional = true, def
thiserror = "1"
tokio = { version = "1", features = ["rt-multi-thread"], optional = true, default-features = false }
tracing = { version = "0.1", default-features = false }
url = { version = "2.1", optional = true }
url = { version = "2.5", optional = true }

[dev-dependencies]
tokio = { version = "1", features = ["rt", "macros"], default-features = false }
Expand Down
8 changes: 4 additions & 4 deletions src/mysql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ fn extract_connect_options(connection_url: &str) -> Result<MySqlConnectOptions,
let username = url.username();
if !username.is_empty() {
options = options.username(
&*percent_decode_str(username)
&percent_decode_str(username)
.decode_utf8()
.map_err(Error::UriConfigurationDecoding)?,
);
}

if let Some(password) = url.password() {
options = options.password(
&*percent_decode_str(password)
&percent_decode_str(password)
.decode_utf8()
.map_err(Error::UriConfigurationDecoding)?,
);
Expand Down Expand Up @@ -167,7 +167,7 @@ mod tests {
async fn test_write_structure_sql() -> Result<(), crate::error::Error> {
let destination_path = std::env::temp_dir().join("sqlx-mysql-structure.sql");
let migrations_path = std::path::PathBuf::from("./fixtures/sqlx/mysql/migrations");
let _ = super::write_structure_sql(
super::write_structure_sql(
super::DEFAULT_CONNECTION_URL,
migrations_path,
&destination_path,
Expand All @@ -184,7 +184,7 @@ mod tests {
async fn test_write_structure_sql() -> Result<(), crate::error::Error> {
let destination_path = std::env::temp_dir().join("diesel-mysql-structure.sql");
let migrations_path = std::path::PathBuf::from("./fixtures/diesel/mysql/migrations");
let _ = super::write_structure_sql(
super::write_structure_sql(
super::DEFAULT_CONNECTION_URL,
migrations_path,
&destination_path,
Expand Down
11 changes: 3 additions & 8 deletions src/mysql/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::str::FromStr;
/// Options for controlling the desired security state of the connection to the MySQL server.
///
/// It is used by the [`ssl_mode`](super::MySqlConnectOptions::ssl_mode) method.
#[derive(Debug, Clone, Copy)]
#[derive(Default, Debug, Clone, Copy)]
pub enum MySqlSslMode {
/// Establish an unencrypted connection.
Disabled,
Expand All @@ -21,6 +21,7 @@ pub enum MySqlSslMode {
/// back to an unencrypted connection if an encrypted connection cannot be established.
///
/// This is the default if `ssl_mode` is not specified.
#[default]
Preferred,

/// Establish an encrypted connection if the server supports encrypted connections.
Expand Down Expand Up @@ -50,12 +51,6 @@ impl std::fmt::Display for MySqlSslMode {
}
}

impl Default for MySqlSslMode {
fn default() -> Self {
MySqlSslMode::Preferred
}
}

impl FromStr for MySqlSslMode {
type Err = String;

Expand All @@ -68,7 +63,7 @@ impl FromStr for MySqlSslMode {
"verify_identity" => MySqlSslMode::VerifyIdentity,

_ => {
return Err(format!("unknown value {s:?} for `ssl_mode`").into());
return Err(format!("unknown value {s:?} for `ssl_mode`"));
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod tests {
) -> Result<(), crate::error::Error> {
let destination_path = std::env::temp_dir().join(destination_filename.as_ref());
let migrations_path = std::path::PathBuf::from(fixtures_path.as_ref()).join("migrations");
let _ = super::write_structure_sql(
super::write_structure_sql(
super::DEFAULT_CONNECTION_URL,
migrations_path,
&destination_path,
Expand Down

0 comments on commit c3b7135

Please sign in to comment.