use timezoned timestamp in event date
This commit is contained in:
parent
f619b1d375
commit
f7ced4b780
2
migrations/2025-04-07-153426_event_timestamptz/down.sql
Normal file
2
migrations/2025-04-07-153426_event_timestamptz/down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE events
|
||||
ALTER COLUMN time TYPE TIMESTAMP;
|
||||
2
migrations/2025-04-07-153426_event_timestamptz/up.sql
Normal file
2
migrations/2025-04-07-153426_event_timestamptz/up.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE events
|
||||
ALTER COLUMN time TYPE TIMESTAMPTZ;
|
||||
@ -6,12 +6,14 @@
|
||||
use crate::db::schema::*;
|
||||
|
||||
use chrono::NaiveDateTime;
|
||||
use chrono::DateTime;
|
||||
use chrono::offset::Utc;
|
||||
use diesel::prelude::*;
|
||||
#[derive(Queryable, Debug, Identifiable)]
|
||||
#[diesel(table_name = events)]
|
||||
pub struct Event {
|
||||
pub id: i32,
|
||||
pub time: NaiveDateTime,
|
||||
pub time: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Debug, Identifiable)]
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
diesel::table! {
|
||||
events (id) {
|
||||
id -> Int4,
|
||||
time -> Timestamp,
|
||||
time -> Timestamptz,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user