MCPcopy Create free account
hub / github.com/hashintel/hash / migrate

Function migrate

apps/hash-graph/src/subcommand/migrate.rs:23–65  ·  view source on GitHub ↗
(args: MigrateArgs)

Source from the content-addressed store, hash-verified

21
22#[tracing::instrument(level = "info", skip(args))]
23pub async fn migrate(args: MigrateArgs) -> Result<(), Report<GraphError>> {
24 let pool = PostgresStorePool::new(
25 &args.db_info,
26 &args.pool_config,
27 NoTls,
28 PostgresStoreSettings::default(),
29 )
30 .await
31 .change_context(GraphError)
32 .map_err(|report| {
33 tracing::error!(error = ?report, "Failed to connect to database");
34 report
35 })?;
36
37 let mut store = pool
38 .acquire(None)
39 .await
40 .change_context(GraphError)
41 .map_err(|report| {
42 tracing::error!(error = ?report, "Failed to acquire database connection");
43 report
44 })?;
45
46 store
47 .run_migrations()
48 .await
49 .change_context(GraphError)
50 .map_err(|report| {
51 tracing::error!(error = ?report, "Failed to run migrations");
52 report
53 })?;
54
55 store
56 .seed_system_policies()
57 .await
58 .change_context(GraphError)
59 .map_err(|report| {
60 tracing::error!(error = ?report, "Failed to seed system policies");
61 report
62 })?;
63
64 Ok(())
65}

Callers 1

executeMethod · 0.70

Calls 7

OkInterface · 0.85
map_errMethod · 0.80
run_migrationsMethod · 0.80
acquireMethod · 0.65
defaultFunction · 0.50
change_contextMethod · 0.45
seed_system_policiesMethod · 0.45

Tested by

no test coverage detected