Skip to content

Commit

Permalink
time: sql_type for DateTimeProxy without backend
Browse files Browse the repository at this point in the history
With the time feature enabled and no active database backend
compilation fails because no sql_type is specified for DateTimeProxy.

This is fixed by always specifying SQL type Datetime regardless of the
enabled backends.
  • Loading branch information
surban committed Aug 5, 2023
1 parent c5a9f7b commit 53961f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diesel/src/type_impls/date_and_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod time {

use crate::deserialize::FromSqlRow;
use crate::expression::AsExpression;
use crate::sql_types::{Date, Time, Timestamp};
use crate::sql_types::{Date, Datetime, Time, Timestamp};

#[derive(AsExpression, FromSqlRow)]
#[diesel(foreign_derive)]
Expand All @@ -81,11 +81,11 @@ mod time {

#[derive(AsExpression, FromSqlRow)]
#[diesel(foreign_derive)]
#[diesel(sql_type = Datetime)]
#[cfg_attr(
feature = "postgres_backend",
diesel(sql_type = crate::sql_types::Timestamptz)
)]
#[cfg_attr(feature = "sqlite", diesel(sql_type = crate::sql_types::TimestamptzSqlite))]
#[cfg_attr(feature = "mysql_backend", diesel(sql_type = crate::sql_types::Datetime))]
struct DateTimeProxy(OffsetDateTime);
}

0 comments on commit 53961f7

Please sign in to comment.