I changed the name of a record in neo4j. Now I'm getting an error that hints at a pending migration.
class CreateOrganization < Neo4j::Migrations::Base
def up
execute("MATCH (n:Institution) SET n:Organization REMOVE n:Institution RETURN n")
end
def down
execute("MATCH (n:Organization) SET n:Institution REMOVE n:Organization RETURN n")
end
end
rails 5.1.4
neo4j 3.3.2
When I check with CALL db.constraints
I can see that they still point to Institution. The goal is for them to point to Organization.
"CONSTRAINT ON ( institution:Institution ) ASSERT institution.uuid IS UNIQUE"
the error looks like this...
Neo4j::DeprecatedSchemaDefinitionError in SessionsController#new
Some schema elements were defined by the model (which is no longer
supported), but they do not exist in the database. Run the following to
create them if you haven't already: rake
neo4j:generate_schema_migration[constraint,Organization,uuid] rake
neo4j:generate_schema_migration[index,Organization,sector] And then run
`rake neo4j:migrate` (zshell users may need to escape the brackets)
When I run
rake neo4j:generate_schema_migration[constraint,Organization,uuid]
I get
zsh: no matches found: neo4j:generate_schema_migration[constraint,Organization,uuid]
UPDATE: After I created the migration provided by Brian in his answer, the part of the error related to the constraint was gone. However the part of the error related to the index remained. I tried to use the helpers the add and drop indexes from the models.
class AddIndexToOrganization < Neo4j::Migrations::Base
def up
add_index :Organization, :uuid
drop_index :Institution, :uuid
end
def down
drop_index :Organization, :uuid
add_index :Institution, :uuid
end
end
I then try to run the migration. This throws and error:
== 20180224004338 AddIndexToOrganization: running...
===========================
rake aborted!
Neo4j::MigrationError: Duplicate index for Organization#uuid
Interestingly when I use CALL db.indexes
I can't find an index on Organization and this remains "INDEX ON :Institution(sector)" "Institution"