Skip to main content

sqlitegraph/graph/
metrics_schema.rs

1//! Metrics and schema operations for SqliteGraph.
2
3use crate::schema::{MigrationReport, read_schema_version, run_pending_migrations};
4
5use super::{SqliteGraph, metrics::GraphMetricsSnapshot};
6
7impl SqliteGraph {
8    pub fn metrics_snapshot(&self) -> GraphMetricsSnapshot {
9        self.metrics.snapshot()
10    }
11
12    pub fn reset_metrics(&self) {
13        self.metrics.reset();
14    }
15
16    pub fn schema_version(&self) -> Result<i64, crate::errors::SqliteGraphError> {
17        let conn = self.connection();
18        read_schema_version(conn.underlying())
19    }
20
21    pub fn run_pending_migrations(
22        &self,
23        dry_run: bool,
24    ) -> Result<MigrationReport, crate::errors::SqliteGraphError> {
25        let conn = self.connection();
26        run_pending_migrations(conn.underlying(), dry_run)
27    }
28}