fix: use timestamp instead of date_time

apparently date_time is TIMESTAMPTZ on postgres, not TIMESTAMP (aka
DateTime<Utc>)...
This commit is contained in:
əlemi 2024-06-07 06:58:35 +02:00
parent 982b7426ce
commit 9fc8a364dd
Signed by: alemi
GPG key ID: A4895B84D311642C
6 changed files with 21 additions and 21 deletions

View file

@ -109,11 +109,11 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Instances::Software).string().null()) .col(ColumnDef::new(Instances::Software).string().null())
.col(ColumnDef::new(Instances::Version).string().null()) .col(ColumnDef::new(Instances::Version).string().null())
.col(ColumnDef::new(Instances::Icon).string().null()) .col(ColumnDef::new(Instances::Icon).string().null())
.col(ColumnDef::new(Instances::DownSince).date_time().null()) .col(ColumnDef::new(Instances::DownSince).timestamp().null())
.col(ColumnDef::new(Instances::Users).big_integer().null()) .col(ColumnDef::new(Instances::Users).big_integer().null())
.col(ColumnDef::new(Instances::Posts).big_integer().null()) .col(ColumnDef::new(Instances::Posts).big_integer().null())
.col(ColumnDef::new(Instances::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Instances::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Instances::Updated).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Instances::Updated).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -161,8 +161,8 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Actors::StatusesCount).integer().not_null().default(0)) .col(ColumnDef::new(Actors::StatusesCount).integer().not_null().default(0))
.col(ColumnDef::new(Actors::PublicKey).string().not_null()) .col(ColumnDef::new(Actors::PublicKey).string().not_null())
.col(ColumnDef::new(Actors::PrivateKey).string().null()) .col(ColumnDef::new(Actors::PrivateKey).string().null())
.col(ColumnDef::new(Actors::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Actors::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Actors::Updated).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Actors::Updated).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -232,8 +232,8 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Objects::Bto).json().null()) .col(ColumnDef::new(Objects::Bto).json().null())
.col(ColumnDef::new(Objects::Cc).json().null()) .col(ColumnDef::new(Objects::Cc).json().null())
.col(ColumnDef::new(Objects::Bcc).json().null()) .col(ColumnDef::new(Objects::Bcc).json().null())
.col(ColumnDef::new(Objects::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Objects::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Objects::Updated).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Objects::Updated).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
).await?; ).await?;
@ -290,7 +290,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Activities::Bto).json().null()) .col(ColumnDef::new(Activities::Bto).json().null())
.col(ColumnDef::new(Activities::Cc).json().null()) .col(ColumnDef::new(Activities::Cc).json().null())
.col(ColumnDef::new(Activities::Bcc).json().null()) .col(ColumnDef::new(Activities::Bcc).json().null())
.col(ColumnDef::new(Activities::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Activities::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
).await?; ).await?;

View file

@ -140,7 +140,7 @@ impl MigrationTrait for Migration {
.on_update(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade)
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Likes::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Likes::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -194,7 +194,7 @@ impl MigrationTrait for Migration {
.on_update(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade)
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Announces::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Announces::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;

View file

@ -129,7 +129,7 @@ impl MigrationTrait for Migration {
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Sessions::Secret).string().not_null()) .col(ColumnDef::new(Sessions::Secret).string().not_null())
.col(ColumnDef::new(Sessions::Expires).date_time().not_null()) .col(ColumnDef::new(Sessions::Expires).timestamp().not_null())
.to_owned() .to_owned()
) )
.await?; .await?;

View file

@ -75,7 +75,7 @@ impl MigrationTrait for Migration {
.to(Objects::Table, Objects::Internal) .to(Objects::Table, Objects::Internal)
.on_update(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Addressing::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Addressing::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -141,8 +141,8 @@ impl MigrationTrait for Migration {
.on_update(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade)
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Deliveries::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Deliveries::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Deliveries::NotBefore).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Deliveries::NotBefore).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Deliveries::Attempt).integer().not_null().default(0)) .col(ColumnDef::new(Deliveries::Attempt).integer().not_null().default(0))
.to_owned() .to_owned()
) )

View file

@ -63,7 +63,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Attachments::DocumentType).string().not_null()) .col(ColumnDef::new(Attachments::DocumentType).string().not_null())
.col(ColumnDef::new(Attachments::Name).string().null()) .col(ColumnDef::new(Attachments::Name).string().null())
.col(ColumnDef::new(Attachments::MediaType).string().not_null()) .col(ColumnDef::new(Attachments::MediaType).string().not_null())
.col(ColumnDef::new(Attachments::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Attachments::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -102,7 +102,7 @@ impl MigrationTrait for Migration {
// .on_update(ForeignKeyAction::Cascade) // .on_update(ForeignKeyAction::Cascade)
// .on_delete(ForeignKeyAction::Cascade) // .on_delete(ForeignKeyAction::Cascade)
// ) // )
.col(ColumnDef::new(Mentions::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Mentions::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;
@ -144,7 +144,7 @@ impl MigrationTrait for Migration {
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Hashtags::Name).string().not_null()) .col(ColumnDef::new(Hashtags::Name).string().not_null())
.col(ColumnDef::new(Hashtags::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Hashtags::Published).timestamp().not_null().default(Expr::current_timestamp()))
.to_owned() .to_owned()
) )
.await?; .await?;

View file

@ -45,8 +45,8 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Jobs::Target).string().null()) .col(ColumnDef::new(Jobs::Target).string().null())
.col(ColumnDef::new(Jobs::Activity).string().not_null()) .col(ColumnDef::new(Jobs::Activity).string().not_null())
.col(ColumnDef::new(Jobs::Payload).string().null()) .col(ColumnDef::new(Jobs::Payload).string().null())
.col(ColumnDef::new(Jobs::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Jobs::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Jobs::NotBefore).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Jobs::NotBefore).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Jobs::Attempt).small_integer().not_null().default(0)) .col(ColumnDef::new(Jobs::Attempt).small_integer().not_null().default(0))
.to_owned() .to_owned()
) )
@ -101,8 +101,8 @@ impl MigrationTrait for Migration {
.on_update(ForeignKeyAction::Cascade) .on_update(ForeignKeyAction::Cascade)
.on_delete(ForeignKeyAction::Cascade) .on_delete(ForeignKeyAction::Cascade)
) )
.col(ColumnDef::new(Deliveries::Published).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Deliveries::Published).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Deliveries::NotBefore).date_time().not_null().default(Expr::current_timestamp())) .col(ColumnDef::new(Deliveries::NotBefore).timestamp().not_null().default(Expr::current_timestamp()))
.col(ColumnDef::new(Deliveries::Attempt).integer().not_null().default(0)) .col(ColumnDef::new(Deliveries::Attempt).integer().not_null().default(0))
.to_owned() .to_owned()
) )