Use timestamp instead of date for added_date column in songs table
All checks were successful
Push Workflows / docs (push) Successful in 56s
Push Workflows / test (push) Successful in 2m23s
Push Workflows / leptos-test (push) Successful in 2m31s
Push Workflows / build (push) Successful in 3m24s
Push Workflows / docker-build (push) Successful in 8m12s
Push Workflows / nix-build (push) Successful in 18m0s
All checks were successful
Push Workflows / docs (push) Successful in 56s
Push Workflows / test (push) Successful in 2m23s
Push Workflows / leptos-test (push) Successful in 2m31s
Push Workflows / build (push) Successful in 3m24s
Push Workflows / docker-build (push) Successful in 8m12s
Push Workflows / nix-build (push) Successful in 18m0s
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
ALTER TABLE songs
|
||||
ALTER COLUMN added_date TYPE DATE USING added_date::DATE,
|
||||
ALTER COLUMN added_date SET DEFAULT CURRENT_DATE,
|
||||
ALTER COLUMN added_date SET NOT NULL;
|
@ -0,0 +1,4 @@
|
||||
ALTER TABLE songs
|
||||
ALTER COLUMN added_date TYPE TIMESTAMP USING added_date::TIMESTAMP,
|
||||
ALTER COLUMN added_date SET DEFAULT CURRENT_TIMESTAMP,
|
||||
ALTER COLUMN added_date SET NOT NULL;
|
@ -691,8 +691,8 @@ pub struct Song {
|
||||
/// The path to the song's image file
|
||||
pub image_path: Option<String>,
|
||||
/// The date the song was added to the database
|
||||
#[cfg_attr(feature = "ssr", diesel(deserialize_as = NaiveDate))]
|
||||
pub added_date: Option<NaiveDate>,
|
||||
#[cfg_attr(feature = "ssr", diesel(deserialize_as = NaiveDateTime))]
|
||||
pub added_date: Option<NaiveDateTime>,
|
||||
}
|
||||
|
||||
impl Song {
|
||||
|
@ -96,7 +96,7 @@ diesel::table! {
|
||||
release_date -> Nullable<Date>,
|
||||
storage_path -> Varchar,
|
||||
image_path -> Nullable<Varchar>,
|
||||
added_date -> Date,
|
||||
added_date -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ use crate::models::{Album, Artist, Song};
|
||||
use crate::components::dashboard_tile::DashboardTile;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{NaiveDate, NaiveDateTime};
|
||||
|
||||
/// Holds information about a song
|
||||
///
|
||||
@ -32,7 +32,7 @@ pub struct SongData {
|
||||
/// Whether the song is liked by the user
|
||||
pub like_dislike: Option<(bool, bool)>,
|
||||
/// The date the song was added to the database
|
||||
pub added_date: NaiveDate,
|
||||
pub added_date: NaiveDateTime,
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user