mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
move migration api out of struct implementation
This commit is contained in:
parent
06f43f34f3
commit
39ee50c4ba
12 changed files with 173 additions and 177 deletions
30
src/app.rs
30
src/app.rs
|
|
@ -233,7 +233,7 @@ impl App {
|
|||
};
|
||||
|
||||
// Begin migration
|
||||
match App::migrate(&transaction) {
|
||||
match migrate(&transaction) {
|
||||
Ok(_) => {
|
||||
// Confirm changes
|
||||
match transaction.commit() {
|
||||
|
|
@ -248,18 +248,18 @@ impl App {
|
|||
// Start application
|
||||
self.gobject.run()
|
||||
}
|
||||
|
||||
// Tools
|
||||
fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
// Migrate self components
|
||||
if let Err(e) = Database::init(&tx) {
|
||||
return Err(e.to_string());
|
||||
}
|
||||
|
||||
// Delegate migration to childs
|
||||
Browser::migrate(&tx)?;
|
||||
|
||||
// Success
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
// Migrate self components
|
||||
if let Err(e) = Database::init(&tx) {
|
||||
return Err(e.to_string());
|
||||
}
|
||||
|
||||
// Delegate migration to childs
|
||||
browser::migrate(&tx)?;
|
||||
|
||||
// Success
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue