-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the rebuild.sh script more OS-agnostic. Also migrate the codebas…
…e to work with UUID and timestamps with timezone support..
- Loading branch information
Showing
15 changed files
with
125 additions
and
96 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
use uuid::Uuid; | ||
|
||
pub mod coaching_relationship; | ||
pub mod organization; | ||
pub mod user; | ||
|
||
/// A type alias that represents any Entity's id field data type | ||
pub type Id = i32; // TODO: consider changing this to a u64 | ||
pub type Id = Uuid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,22 +76,32 @@ pub(crate) async fn seed_database(db: &DatabaseConnection) { | |
email: ActiveValue::Set("[email protected]".to_owned()), | ||
first_name: ActiveValue::Set("Jim".to_owned()), | ||
last_name: ActiveValue::Set("Hodapp".to_owned()), | ||
display_name: ActiveValue::Set("Jim H".to_owned()), | ||
password: ActiveValue::Set(generate_hash("password1").to_owned()), | ||
github_username: ActiveValue::Set("jhodapp".to_owned()), | ||
github_profile_url: ActiveValue::Set("https://github.com/jhodapp".to_owned()), | ||
created_at: ActiveValue::NotSet, | ||
updated_at: ActiveValue::NotSet, | ||
}, | ||
user::ActiveModel { | ||
id: ActiveValue::NotSet, | ||
email: ActiveValue::Set("[email protected]".to_owned()), | ||
first_name: ActiveValue::Set("Test First".to_owned()), | ||
last_name: ActiveValue::Set("Test Last".to_owned()), | ||
display_name: ActiveValue::Set("Test User".to_owned()), | ||
password: ActiveValue::Set(generate_hash("password2").to_owned()), | ||
github_username: ActiveValue::Set("test".to_owned()), | ||
github_profile_url: ActiveValue::Set("https://github.com/test".to_owned()), | ||
created_at: ActiveValue::NotSet, | ||
updated_at: ActiveValue::NotSet, | ||
}, | ||
]; | ||
|
||
for user in users { | ||
debug!("user: {:?}", user); | ||
|
||
// Upserts seeded user data: | ||
let _res = user::Entity::insert(user) | ||
match user::Entity::insert(user) | ||
.on_conflict( | ||
// on conflict do update | ||
sea_query::OnConflict::column(user::Column::Email) | ||
|
@@ -101,6 +111,10 @@ pub(crate) async fn seed_database(db: &DatabaseConnection) { | |
.to_owned(), | ||
) | ||
.exec(db) | ||
.await; | ||
.await | ||
{ | ||
Ok(_) => info!("Succeeded in seeding user data."), | ||
Err(e) => error!("Failed to insert or update user when seeding user data: {e}"), | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.