-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Neo4J Support in Go Migrate [WIP] #1
Conversation
Some current issues I am dealing with:
|
The Driver definition file mentions that you can return |
@ACPrice and @jomarquez |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments, keep in mind I haven't touched neo4j in a long time nor have I messed with go migrate in awhile so might not be too relevant.
} | ||
|
||
func isReady(ctx context.Context, c dktest.ContainerInfo) bool { | ||
ip, port, err := c.Port(7687) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hardcoded port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for a test, the function asks the docker test suite which docker port has been mapped to 7687, which is the bolt exposed port in the neo docker container. In real usage, the port would be provided by the URL the user gives
|
||
func (n *Neo4J) Unlock() error { | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these? Just to fulfill interface methods?
doesn't seem like we need a sync.Mutex
for Neo4J
struct.
Also now that I see it, did you mean to have capital J for Neo4J?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a generic Driver
interface that go migrate has you fill out, and requests you return nil
if the database isn't capable of locking (which Neo isn't).
You are correct about the J, I have replaced it with lowercase
database/neo4j/neo4j.go
Outdated
defer session.Close() | ||
|
||
_, err = session.Run("MERGE (sm:$migration {version: $version, dirty: $dirty})", | ||
map[string]interface{}{"migration": n.config.MigrationsLabel, "version": version, "dirty": dirty}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm with this, wouldn't it be possible to get two nodes with same version but differing dirty
bool state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be because we run a ensureVersionConstraint
function during driver creation that enforces a unique constraint on version number
database/neo4j/neo4j.go
Outdated
version = -1 | ||
} | ||
|
||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't return version
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the variable are named in the function signature, they will all be returned with an empty return
statement. I have changed it to return explicitly for consistency
My attempt at providing an implementation of migrate for Neo4J. Based on previous work by @axiomzen here
WithInstance
. This function should accept an existing DB instance and a Config{} struct and return a driver instance.