db: Change the DB storage type to NaiveDateTime
The entire internals of the server now work using only NaiveDateTime, since we know they are all UTC. At the fringes (LDAP, GraphQL, JWT tokens) we convert back into UTC to make sure we have a clear API. This allows us to be compatible with Postgres (which doesn't support DateTime<UTC>, only NaiveDateTime). This change is backwards compatible since in SQlite with Sea-query/Sea-ORM, the UTC datetimes are stored without a timezone, as simple strings. It's the same format as NaiveDateTime. Fixes #87.
This commit is contained in:
committed by
nitnelave
parent
692bbb00f1
commit
e458aca3e3
@@ -170,7 +170,7 @@ pub async fn upgrade_to_v1(pool: &DbConnection) -> std::result::Result<(), sea_o
|
||||
struct ShortGroupDetails {
|
||||
group_id: GroupId,
|
||||
display_name: String,
|
||||
creation_date: chrono::DateTime<chrono::Utc>,
|
||||
creation_date: chrono::NaiveDateTime,
|
||||
}
|
||||
for result in ShortGroupDetails::find_by_statement(
|
||||
builder.build(
|
||||
@@ -220,7 +220,7 @@ pub async fn upgrade_to_v1(pool: &DbConnection) -> std::result::Result<(), sea_o
|
||||
#[derive(FromQueryResult)]
|
||||
struct ShortUserDetails {
|
||||
user_id: UserId,
|
||||
creation_date: chrono::DateTime<chrono::Utc>,
|
||||
creation_date: chrono::NaiveDateTime,
|
||||
}
|
||||
for result in ShortUserDetails::find_by_statement(
|
||||
builder.build(
|
||||
|
||||
Reference in New Issue
Block a user