diff --git a/Dockerfile b/Dockerfile index 2873683..010d61c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -138,7 +138,7 @@ RUN curl -sSL https://www.sqlite.org/2024/sqlite-autoconf-$SQLITE_VER.tar.gz | t # See https://github.com/sgrif/pq-sys/pull/18 ENV PATH=/root/.cargo/bin:$PREFIX/bin:$PATH \ RUSTUP_HOME=/root/.rustup \ - CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \ + CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \ PKG_CONFIG_ALLOW_CROSS=true \ PKG_CONFIG_ALL_STATIC=true \ PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=true \ diff --git a/test/dieselpgcrate/Cargo.toml b/test/dieselpgcrate/Cargo.toml index 98ff2e7..da90411 100644 --- a/test/dieselpgcrate/Cargo.toml +++ b/test/dieselpgcrate/Cargo.toml @@ -4,5 +4,5 @@ name = "dieselpgcrate" version = "0.1.0" [dependencies] -diesel = { version = "1.4.*", features = ["postgres"] } +diesel = { version = "2.1.*", features = ["postgres"] } openssl = "*" diff --git a/test/dieselpgcrate/src/main.rs b/test/dieselpgcrate/src/main.rs index 880e00a..ef54577 100644 --- a/test/dieselpgcrate/src/main.rs +++ b/test/dieselpgcrate/src/main.rs @@ -1,51 +1,52 @@ // The order of these extern crate lines matter for ssl! extern crate openssl; -#[macro_use] extern crate diesel; +#[macro_use] +extern crate diesel; // openssl must be included before diesel atm. mod schema { - table! { - posts (id) { - id -> Int4, - title -> Varchar, - body -> Text, - published -> Bool, - } - } + table! { + posts (id) { + id -> Int4, + title -> Varchar, + body -> Text, + published -> Bool, + } + } } mod models { - use schema::posts; - #[derive(Queryable)] - pub struct Post { - pub id: i32, - pub title: String, - pub body: String, - pub published: bool, - } + use schema::posts; + #[derive(Queryable)] + pub struct Post { + pub id: i32, + pub title: String, + pub body: String, + pub published: bool, + } - // apparently this can be done without heap storage, but lifetimes spread far.. - #[derive(Insertable)] - #[table_name="posts"] - pub struct NewPost { - pub title: String, - pub body: String, - } + // apparently this can be done without heap storage, but lifetimes spread far.. + #[derive(Insertable)] + #[diesel(table_name = posts)] + pub struct NewPost { + pub title: String, + pub body: String, + } } -use diesel::prelude::*; use diesel::pg::PgConnection; +use diesel::prelude::*; fn main() { let database_url = std::env::var("DATABASE_URL") - .unwrap_or("postgres://localhost?connect_timeout=1&sslmode=require".into()); + .unwrap_or("postgres://localhost?connect_timeout=1&sslmode=require".into()); match PgConnection::establish(&database_url) { - Err(e) => { - println!("Should fail to connect here:"); - println!("{}", e); - } - Ok(_) => { - unreachable!(); - } + Err(e) => { + println!("Should fail to connect here:"); + println!("{}", e); + } + Ok(_) => { + unreachable!(); + } } } diff --git a/test/dieselsqlitecrate/Cargo.toml b/test/dieselsqlitecrate/Cargo.toml index 7a1774d..266daf3 100644 --- a/test/dieselsqlitecrate/Cargo.toml +++ b/test/dieselsqlitecrate/Cargo.toml @@ -4,4 +4,4 @@ name = "dieselsqlitecrate" version = "0.1.0" [dependencies] -diesel = { version = "1.4.*", features = ["sqlite"] } +diesel = { version = "2.1.*", features = ["sqlite"] } diff --git a/test/dieselsqlitecrate/src/main.rs b/test/dieselsqlitecrate/src/main.rs index 2407295..448479f 100644 --- a/test/dieselsqlitecrate/src/main.rs +++ b/test/dieselsqlitecrate/src/main.rs @@ -2,33 +2,33 @@ extern crate diesel; mod schema { - table! { - posts (id) { - id -> Int4, - title -> Varchar, - body -> Text, - published -> Bool, - } - } + table! { + posts (id) { + id -> Int4, + title -> Varchar, + body -> Text, + published -> Bool, + } + } } mod models { - use schema::posts; - #[derive(Queryable)] - pub struct Post { - pub id: i32, - pub title: String, - pub body: String, - pub published: bool, - } + use schema::posts; + #[derive(Queryable)] + pub struct Post { + pub id: i32, + pub title: String, + pub body: String, + pub published: bool, + } - // apparently this can be done without heap storage, but lifetimes spread far.. - #[derive(Insertable)] - #[table_name="posts"] - pub struct NewPost { - pub title: String, - pub body: String, - } + // apparently this can be done without heap storage, but lifetimes spread far.. + #[derive(Insertable)] + #[diesel(table_name = posts)] + pub struct NewPost { + pub title: String, + pub body: String, + } } use diesel::prelude::*; diff --git a/test/pqcrate/Cargo.toml b/test/pqcrate/Cargo.toml index 75ba625..6241052 100644 --- a/test/pqcrate/Cargo.toml +++ b/test/pqcrate/Cargo.toml @@ -4,5 +4,5 @@ name = "pqcrate" version = "0.1.0" [dependencies] -pq-sys = "0.4.5" +pq-sys = "0.5" openssl = "*"