some newver/oldver logics

This commit is contained in:
NikVolf 2016-04-10 17:15:40 +03:00
parent d3411a50a4
commit 26e23da4c0
2 changed files with 14 additions and 2 deletions

View File

@ -780,6 +780,17 @@ fn die_with_io_error(e: std::io::Error) -> ! {
}
fn main() {
match ::upgrade::upgrade() {
Ok(upgrades_applied) => {
if upgrades_applied > 0 {
println!("Executed {} upgrade scripts - ok", upgrades_applied);
}
},
Err(e) => {
die!("Error upgrading parity data: {:?}", e);
}
}
Configuration::parse().execute();
}

View File

@ -18,11 +18,11 @@
use semver::Version;
use std::collections::*;
use std::path::*;
use std::fs::File;
use std::env;
use std::io::{Read, Write};
#[derive(Debug)]
pub enum Error {
CannotLockVersionFile,
CannotUpdateVersionFile,
@ -61,6 +61,7 @@ impl UpgradeKey {
// dummy upgrade (remove when the first one is in)
fn dummy_upgrade() -> Result<(), Error> {
println!("Adding ver.lock");
Ok(())
}
@ -68,7 +69,7 @@ fn push_updrades(upgrades: &mut UpgradeList)
{
// dummy upgrade (remove when the first one is in)
upgrades.insert(
UpgradeKey { old_version: Version::parse("1.0.0").unwrap(), new_version: Version::parse("99.99.0").unwrap() },
UpgradeKey { old_version: Version::parse("0.9.0").unwrap(), new_version: Version::parse("1.0.0").unwrap() },
dummy_upgrade);
}