Skip to content

Commit

Permalink
Merge pull request #131 from clux/bump-test-deps
Browse files Browse the repository at this point in the history
bump test deps for pq and diesel
  • Loading branch information
clux authored Feb 13, 2024
2 parents 2e273a4 + 59f73ef commit e13ed1f
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion test/dieselpgcrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ name = "dieselpgcrate"
version = "0.1.0"

[dependencies]
diesel = { version = "1.4.*", features = ["postgres"] }
diesel = { version = "2.1.*", features = ["postgres"] }
openssl = "*"
67 changes: 34 additions & 33 deletions test/dieselpgcrate/src/main.rs
Original file line number Diff line number Diff line change
@@ -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!();
}
}
}
2 changes: 1 addition & 1 deletion test/dieselsqlitecrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ name = "dieselsqlitecrate"
version = "0.1.0"

[dependencies]
diesel = { version = "1.4.*", features = ["sqlite"] }
diesel = { version = "2.1.*", features = ["sqlite"] }
46 changes: 23 additions & 23 deletions test/dieselsqlitecrate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion test/pqcrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ name = "pqcrate"
version = "0.1.0"

[dependencies]
pq-sys = "0.4.5"
pq-sys = "0.5"
openssl = "*"

0 comments on commit e13ed1f

Please sign in to comment.