Compare commits
No commits in common. "2f7e1c9924efe8f28e84f86b66643aafe4fd89d9" and "3293bed51e785971a4f909fed8135c67645a5a99" have entirely different histories.
2f7e1c9924
...
3293bed51e
3 changed files with 2 additions and 13 deletions
|
@ -19,7 +19,6 @@ pub struct Model {
|
|||
pub name: String,
|
||||
pub email: String,
|
||||
pub hash: String,
|
||||
pub admin: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
|
||||
|
@ -28,7 +27,6 @@ pub enum Column {
|
|||
Name,
|
||||
Email,
|
||||
Hash,
|
||||
Admin,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
|
||||
|
@ -54,7 +52,6 @@ impl ColumnTrait for Column {
|
|||
Self::Name => ColumnType::String(None).def(),
|
||||
Self::Email => ColumnType::String(None).def().unique(),
|
||||
Self::Hash => ColumnType::String(None).def(),
|
||||
Self::Admin => ColumnType::Boolean.def(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ impl MigrationTrait for Migration {
|
|||
.col(ColumnDef::new(User::Name).string().not_null())
|
||||
.col(ColumnDef::new(User::Email).string().not_null().unique_key())
|
||||
.col(ColumnDef::new(User::Hash).string().not_null())
|
||||
.col(ColumnDef::new(User::Admin).boolean().not_null())
|
||||
.to_owned(),
|
||||
)
|
||||
.await
|
||||
|
@ -41,5 +40,4 @@ enum User {
|
|||
Name,
|
||||
Email,
|
||||
Hash,
|
||||
Admin,
|
||||
}
|
||||
|
|
|
@ -17,13 +17,8 @@ impl MigrationTrait for Migration {
|
|||
.expect("Generating Admin Password Hash failed");
|
||||
let insert = Query::insert()
|
||||
.into_table(User::Table)
|
||||
.columns([User::Name, User::Email, User::Hash, User::Admin])
|
||||
.values_panic([
|
||||
"admin".into(),
|
||||
"admin".into(),
|
||||
hash.to_string().into(),
|
||||
true.into(),
|
||||
])
|
||||
.columns([User::Name, User::Email, User::Hash])
|
||||
.values_panic(["admin".into(), "admin".into(), hash.to_string().into()])
|
||||
.to_owned();
|
||||
|
||||
manager.exec_stmt(insert).await?;
|
||||
|
@ -41,5 +36,4 @@ enum User {
|
|||
Name,
|
||||
Email,
|
||||
Hash,
|
||||
Admin,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue