Skip to content

Commit

Permalink
move table definition to relevant test method
Browse files Browse the repository at this point in the history
  • Loading branch information
heyrutvik authored and weiznich committed Oct 2, 2022
1 parent c8f4e4f commit 3455cfe
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions diesel_tests/tests/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ use crate::schema::*;
use diesel::connection::BoxableConnection;
use diesel::*;

table! {
auto_time {
id -> Integer,
n -> Integer,
updated_at -> Timestamp,
}
}

#[test]
#[cfg(any(feature = "postgres", feature = "sqlite"))]
fn managing_updated_at_for_table() {
use self::auto_time::dsl::*;
use crate::schema_dsl::*;
use chrono::NaiveDateTime;
use std::{thread, time::Duration};

table! {
#[sql_name = "auto_time"]
auto_time_table {
id -> Integer,
n -> Integer,
updated_at -> Timestamp,
}
}
use auto_time_table::dsl::{auto_time_table as auto_time, n, updated_at};

// transactions have frozen time, so we can't use them
let connection = &mut connection_without_transaction();
create_table(
Expand Down

0 comments on commit 3455cfe

Please sign in to comment.