Thank you for the welcome
I totally agree with you that the behavior in neo4j 4.x is the correct behavior. But the thing is, because of the way it was designed in 3.x, it let us do something like this:
We have a file which contains all the constraints that we want to exist within the system, say
constraints.js. it looks something like this:
const constraints = [
The idea is that this file runs every time our system restarts, and it runs all the
Create constraint statements for each constraint that exists in that array. Now I know that might not be a good strategy to have, but the biggest advantage of that approach was that since creating constraints was idempotent in 3.x, whenever we needed to add a new constraint to our database, we would have to just update that file by adding a new constraint, and the new constraint would be added onto the system automatically after we pushed the changes. We did not have to add the constraint manually to the db. All the older constraints would also run but would have no effect and no error.
Now in 4.x, that design breaks, since running constraints that already exist in the system errors out. Now we have to think of a way to query the system before we run any constraints to check if that constraint exists or not, and to run the constraint only if it does not exist.
Again, I believe 4.x is the correct behavior, but it does make it inconvenient.