Skip to content

Commit c990b33

Browse files
authored
Fix compilation without features (#44)
* Fix for unspecified features * cargo fmt and clippy * Upgrade to v0.4.2 and added entry for the version in changelog * Correction of a comment * Test fix * Cargo fmt and clippy * Fix unused import clippy
1 parent d4e1502 commit c990b33

6 files changed

Lines changed: 22 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ Year format is defined as: `YYYY-m-d`
99

1010
## [Unreleased]
1111

12-
## [0.4.1 - 2023 - 04 - 23
12+
## [0.4.2 - 2023 - 05 - 02]
13+
14+
### Bugfix
15+
16+
Fixed a bug related to migrations that prevented compiling if features were not specified.
17+
18+
## [0.4.1 - 2023 - 04 - 23]
1319

1420
### Feature
1521

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ tokio-postgres = { workspace = true, optional = true }
3333
tiberius = { workspace = true, optional = true }
3434

3535
[workspace.dependencies]
36-
canyon_crud = { version = "0.4.1", path = "canyon_crud" }
37-
canyon_connection = { version = "0.4.1", path = "canyon_connection" }
38-
canyon_entities = { version = "0.4.1", path = "canyon_entities" }
39-
canyon_migrations = { version = "0.4.1", path = "canyon_migrations"}
40-
canyon_macros = { version = "0.4.1", path = "canyon_macros" }
36+
canyon_crud = { version = "0.4.2", path = "canyon_crud" }
37+
canyon_connection = { version = "0.4.2", path = "canyon_connection" }
38+
canyon_entities = { version = "0.4.2", path = "canyon_entities" }
39+
canyon_migrations = { version = "0.4.2", path = "canyon_migrations"}
40+
canyon_macros = { version = "0.4.2", path = "canyon_macros" }
4141

4242
tokio = { version = "1.27.0", features = ["full"] }
4343
tokio-util = { version = "0.7.4", features = ["compat"] }
@@ -61,7 +61,7 @@ quote = "1.0.9"
6161
proc-macro2 = "1.0.27"
6262

6363
[workspace.package]
64-
version = "0.4.1"
64+
version = "0.4.2"
6565
edition = "2021"
6666
authors = ["Alex Vergara<pyzyryab@tutanota.com>, Gonzalo Busto Musi<gonzalo.busto@gmail.com>"]
6767
documentation = "https://zerodaycode.github.io/canyon-book/"

bash_aliases.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# In order to run the script, simply type `$ . ./bash_aliases.sh` from the root of the project.
88
# (refreshing the current terminal session could be required)
99

10-
# Executes the docker compose script to wake up the postgres container
10+
# Executes the docker compose script to wake up the containers
1111
alias DockerUp='docker-compose -f ./docker/docker-compose.yml up'
1212
# Shutdown the postgres container
1313
alias DockerDown='docker-compose -f ./docker/docker-compose.yml down'

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
extern crate canyon_connection;
77
extern crate canyon_crud;
88
extern crate canyon_macros;
9+
#[cfg(feature = "migrations")]
910
extern crate canyon_migrations;
1011

1112
/// Reexported elements to the root of the public API
13+
#[cfg(feature = "migrations")]
1214
pub mod migrations {
1315
pub use canyon_migrations::migrations::{handler, processor};
1416
}

tests/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub const PSQL_DS: &str = "postgres_docker";
55
#[cfg(feature = "mssql")]
66
pub const SQL_SERVER_DS: &str = "sqlserver_docker";
77

8-
#[cfg(feature = "postgres")]
8+
#[cfg(all(feature = "postgres", feature = "migrations"))]
99
pub static FETCH_PUBLIC_SCHEMA: &str =
1010
"SELECT
1111
gi.table_name,

tests/migrations/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#![allow(unused_imports)]
2-
///! Integration tests for the migrations feature of `Canyon-SQL`
3-
use canyon_sql::{crud::Transaction, migrations::handler::Migrations};
4-
52
use crate::constants;
3+
///! Integration tests for the migrations feature of `Canyon-SQL`
4+
use canyon_sql::crud::Transaction;
5+
#[cfg(feature = "migrations")]
6+
use canyon_sql::migrations::handler::Migrations;
67

78
/// Brings the information of the `PostgreSQL` requested schema
8-
#[cfg(feature = "postgres")]
9+
#[cfg(all(feature = "postgres", feature = "migrations"))]
910
#[canyon_sql::macros::canyon_tokio_test]
1011
fn test_migrations_postgresql_status_query() {
1112
let results = Migrations::query(constants::FETCH_PUBLIC_SCHEMA, [], constants::PSQL_DS).await;

0 commit comments

Comments
 (0)