Skip to content

Neo4J: migrate only runs in session tied to the default database #413

@smoyer64

Description

@smoyer64

Is your feature request related to a problem? Please describe.
In our development and acceptance environments, we often have several databases running on a database server as our CI/CD system will create a new one for each feature branch of a project. This isn't a problem when migrating PostgreSQL (e.g) as the database name is part of the URL and migrate parses it out of the URL's path then uses the specified database (or looks up the current database via a query). In the Neo4J implementation, it's possible to set the database name as part of the Driver.Session but the migrate executable doesn't do that.

Describe the solution you'd like
Add a dbname query parameter which can be mapped into DatabaseName in neo4j.Config. If this value is absent, let migrate continue to use the default database (the equivalent of the PostgreSQL behavior), otherwise, set SessionConfig.DatabaseName in each of the five places where a Session is created in neo4j.go

Describe alternatives you've considered
Having something else in our CI/CD system set the Neo4J default database before migrate is run. This works fine so long as only one job runs at a time but breaks when the second job changes the default database while the first is in the middle of executing migrations.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions