Skip to content

Commit

Permalink
migrate before updating (#405)
Browse files Browse the repository at this point in the history
* migrate before updating

* supress clippy lint
  • Loading branch information
insipx authored Dec 15, 2021
1 parent 1e26a8e commit b5ee4d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions substrate-archive/src/actors/workers/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ pub enum GetState {
/// A response to `GetState`
/// it is callers responsiblity to make sure to call the
/// correct method on the implement after receiving the message
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
pub enum StateResponse {
Conn(DbConn),
Expand Down
3 changes: 2 additions & 1 deletion substrate-archive/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ where
H: AsRef<[u8]>,
{
let mut conn = PgConnection::connect(url.as_ref()).await?;
let persistent_config = PersistentConfig::fetch_and_update(&mut conn, version, genesis).await?;

sqlx::migrate!("./src/migrations/").run(&mut conn).await?;
let persistent_config = PersistentConfig::fetch_and_update(&mut conn, version, genesis).await?;

Ok(persistent_config)
}

Expand Down

0 comments on commit b5ee4d6

Please sign in to comment.