add new dancer struct

dont want to need to throw strings on the heap to create new dancers in the database
This commit is contained in:
Zynh0722 2023-11-05 12:06:18 -08:00
parent b17c2ac1b0
commit c0812dd310

View file

@ -30,6 +30,15 @@ pub struct Dancer {
pub name: String,
}
#[derive(Insertable, Debug)]
#[diesel(table_name = crate::schema::dancers)]
#[diesel(check_for_backend(diesel::mysql::Mysql))]
pub struct NewDancer<'a> {
pub id: u32,
pub stage_name: &'a str,
pub name: &'a str,
}
#[derive(Identifiable, Queryable, Selectable, Debug)]
#[diesel(belongs_to(Dancer, foreign_key = dancer))]
#[diesel(table_name = crate::schema::shows)]