Skip to content

Commit 1a31a2e

Browse files
committed
test: change "single_model_file" to be compile-able
1 parent 3b1dbf5 commit 1a31a2e

File tree

7 files changed

+33
-3
lines changed

7 files changed

+33
-3
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ members = [
5151
"test/simple_table_mysql",
5252
"test/simple_table_sqlite",
5353
"test/custom_model_and_schema_path",
54+
"test/single_model_file",
5455
]
5556
resolver = "2"

test/single_model_file/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[lib]
2+
path = "lib.rs"
3+
4+
[package]
5+
name = "single_model_file"
6+
version = "0.1.0"
7+
edition = "2021"
8+
9+
[dependencies]
10+
diesel = { version = "*", default-features = false, features = [
11+
"postgres",
12+
"chrono",
13+
] }
14+
dsync = { path = "../../" }
15+
chrono = { version = "*", features = ["serde"] }
16+
serde = { version = "*", features = ["derive"] }

test/single_model_file/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod models;
2+
pub mod schema;

test/single_model_file/models/table1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use diesel::*;
44
use crate::schema::*;
55
use diesel::QueryResult;
66

7-
pub type ConnectionType = diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::prelude::PgConnection>>;
7+
pub type ConnectionType = diesel::prelude::PgConnection;
88

99
/// Struct representing a row in table `table1`
1010
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable)]

test/single_model_file/models/table2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use diesel::*;
44
use crate::schema::*;
55
use diesel::QueryResult;
66

7-
pub type ConnectionType = diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::prelude::PgConnection>>;
7+
pub type ConnectionType = diesel::prelude::PgConnection;
88

99
/// Struct representing a row in table `table2`
1010
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable)]

test/single_model_file/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
44

55
cd $SCRIPT_DIR
66

7-
cargo run -- -i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::prelude::PgConnection>>" --single-model-file
7+
cargo run --manifest-path ../../Cargo.toml -- \
8+
-i schema.rs -o models -g id -g created_at -g updated_at -c "diesel::prelude::PgConnection" --single-model-file

0 commit comments

Comments
 (0)