Run migrations on start, not on every connection
This commit is contained in:
parent
d93501cb00
commit
df63c25646
1 changed files with 4 additions and 1 deletions
|
@ -46,11 +46,14 @@ fn core_main() -> Result<(), Box<std::error::Error>> {
|
|||
.map(|p| p.parse().expect("Guaranteed by validator"))
|
||||
.unwrap_or(8080);
|
||||
|
||||
// Connect to the database and run migrations up front:
|
||||
db::connect_database(&db_file, true);
|
||||
|
||||
let server =
|
||||
hyper::server::Http::new()
|
||||
.bind(
|
||||
&SocketAddr::new(bind_host, bind_port),
|
||||
move || Ok(site::Site::new(state::State::new(db::connect_database(&db_file, true))))
|
||||
move || Ok(site::Site::new(state::State::new(db::connect_database(&db_file, false))))
|
||||
)?;
|
||||
|
||||
server.run()?;
|
||||
|
|
Loading…
Reference in a new issue