Compare commits
2 commits
ccfefbf501
...
2afe17f1c0
Author | SHA1 | Date | |
---|---|---|---|
2afe17f1c0 | |||
b03ea80e8e |
3 changed files with 12 additions and 9 deletions
|
@ -4,6 +4,7 @@ CREATE TABLE
|
|||
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
|
||||
dancer INT UNSIGNED NOT NULL,
|
||||
start DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
estimated_end DATETIME NOT NULL,
|
||||
end DATETIME DEFAULT NULL,
|
||||
FOREIGN KEY (dancer) REFERENCES dancers (id) ON DELETE RESTRICT
|
||||
)
|
||||
|
|
|
@ -22,6 +22,15 @@ pub struct Drink {
|
|||
pub time: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Insertable, Deserialize, Debug)]
|
||||
#[diesel(table_name = crate::schema::drinks)]
|
||||
#[diesel(check_for_backend(diesel::mysql::Mysql))]
|
||||
pub struct NewDrink {
|
||||
pub price: u32,
|
||||
pub quantity: u32,
|
||||
pub shift: u32,
|
||||
}
|
||||
|
||||
#[derive(Identifiable, Queryable, Selectable, Debug, Clone)]
|
||||
#[diesel(table_name = crate::schema::dancers)]
|
||||
#[diesel(check_for_backend(diesel::mysql::Mysql))]
|
||||
|
@ -47,14 +56,6 @@ pub struct Show {
|
|||
pub id: u32,
|
||||
pub dancer: u32,
|
||||
pub start: chrono::NaiveDateTime,
|
||||
pub estimated_end: chrono::NaiveDateTime,
|
||||
pub end: Option<chrono::NaiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Insertable, Deserialize, Debug)]
|
||||
#[diesel(table_name = crate::schema::drinks)]
|
||||
#[diesel(check_for_backend(diesel::mysql::Mysql))]
|
||||
pub struct NewDrink {
|
||||
pub price: u32,
|
||||
pub quantity: u32,
|
||||
pub shift: u32,
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ diesel::table! {
|
|||
id -> Unsigned<Integer>,
|
||||
dancer -> Unsigned<Integer>,
|
||||
start -> Datetime,
|
||||
estimated_end -> Datetime,
|
||||
end -> Nullable<Datetime>,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue