summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2017-12-24 15:55:13 +0100
committerJokler <jokler.contact@gmail.com>2017-12-24 15:55:13 +0100
commit3d28c4e4bcff399e294a507187e051839f74ee87 (patch)
tree80a5c7c2fe535575a5f9f3dad27dde8a035d1588
parentc0f68f11396713ffc1ec99ee49b9c16ff55f6824 (diff)
downloadfrippy-3d28c4e4bcff399e294a507187e051839f74ee87.tar.gz
frippy-3d28c4e4bcff399e294a507187e051839f74ee87.zip
Switch to HashMap if the migrations failed to run
-rw-r--r--bin/main.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/main.rs b/bin/main.rs
index 8f1877a..9373afd 100644
--- a/bin/main.rs
+++ b/bin/main.rs
@@ -118,8 +118,13 @@ fn main() {
use diesel::Connection;
match diesel::mysql::MysqlConnection::establish(url) {
Ok(conn) => {
- embedded_migrations::run(&conn).unwrap();
- bot.add_plugin(plugins::Factoids::new(conn));
+ match embedded_migrations::run(&conn) {
+ Ok(_) => bot.add_plugin(plugins::Factoids::new(conn)),
+ Err(e) => {
+ bot.add_plugin(plugins::Factoids::new(HashMap::new()));
+ error!("Failed to run migrations: {}", e);
+ }
+ }
}
Err(e) => error!("Failed to connect to database: {}", e),
}