Implement MigrationManager on PostgresBackend
This change implements the MigrationManager trait on the
PostgresBackend.
embed_migrations!("./src/state/merkle/sql/migration/postgres/migrations");
use crate::error::InternalError;
+use crate::state::merkle::sql::backend::{Backend, Connection, PostgresBackend};
+
+use super::MigrationManager;
/// Run database migrations to create tables defined for the SqlMerkleState.
///
@@ -35,3 +38,9 @@ pub fn run_migrations(conn: &diesel::pg::PgConnection) -> Result<(), InternalErr
Ok(())
}
+
+impl MigrationManager for PostgresBackend {
+ fn run_migrations(&self) -> Result<(), InternalError> {
+ run_migrations(self.connection()?.as_inner())
+ }
+}
