Package ac.simons.neo4j.migrations.core
Interface MigrationContext
public interface MigrationContext
Parameter object / context for migrations to be applied.
- Since:
- 0.0.2
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescriptionThe details will give detailed information about the user being connected, server address and which databases - if available - are being migrated and which are used to store the schema.org.neo4j.driver.Driver
org.neo4j.driver.Session
The schema database might or might not be identical with the database that is to be migrated.default org.neo4j.driver.Session
Convenience method to return an imperative session against the configured server and database.org.neo4j.driver.SessionConfig
Use this session config in your Java-based migration to make sure you use the same database as the migration tool itself.org.neo4j.driver.SessionConfig
getSessionConfig
(UnaryOperator<org.neo4j.driver.SessionConfig.Builder> configCustomizer) This method provides a callback that will be applied to theSessionConfig.Builder
just before aSessionConfig
is created.static MigrationContext
of
(MigrationsConfig config, org.neo4j.driver.Driver driver) This creates amigration context
outside of an otherwise configuredmigration instance
.
-
Method Details
-
of
This creates amigration context
outside of an otherwise configuredmigration instance
. It will behave exactly as the context handed out by migrations toclass based migrations
,- Parameters:
config
- The configuration to usedriver
- The instance of the driver to use, might as well be a mock- Returns:
- A new context, independent of any other migration instance or configuration
- Since:
- 1.16.0
-
getConfig
MigrationsConfig getConfig()- Returns:
- The configuration of this migration instance.
-
getDriver
org.neo4j.driver.Driver getDriver()- Returns:
- The driver to be used inside migrations.
-
getSessionConfig
org.neo4j.driver.SessionConfig getSessionConfig()Use this session config in your Java-based migration to make sure you use the same database as the migration tool itself.- Returns:
- A correctly configured write access session config.
-
getSessionConfig
org.neo4j.driver.SessionConfig getSessionConfig(UnaryOperator<org.neo4j.driver.SessionConfig.Builder> configCustomizer) This method provides a callback that will be applied to theSessionConfig.Builder
just before aSessionConfig
is created.- Parameters:
configCustomizer
- Customization callback for the builder.- Returns:
- The final session config.
- Since:
- 1.1.0
-
getSession
default org.neo4j.driver.Session getSession()Convenience method to return an imperative session against the configured server and database.- Returns:
- A session configured to use the migration context's database name.
-
getSchemaSession
org.neo4j.driver.Session getSchemaSession()The schema database might or might not be identical with the database that is to be migrated. The schema database contains the objects that neo4j-migrations requires to work.- Returns:
- A session accessing the configured schema database if any or the default database.
-
getConnectionDetails
ConnectionDetails getConnectionDetails()The details will give detailed information about the user being connected, server address and which databases - if available - are being migrated and which are used to store the schema.- Returns:
- Details about the connection being used within the context of migrations.
- Since:
- 1.4.0
-
getCatalog
Catalog getCatalog()- Returns:
- the catalog known to this context.
-