Skip to content

Instantly share code, notes, and snippets.

@michael-simons
Last active November 1, 2019 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michael-simons/e2d02d9c3e1365a93a78dbeecf9d4ff5 to your computer and use it in GitHub Desktop.
Save michael-simons/e2d02d9c3e1365a93a78dbeecf9d4ff5 to your computer and use it in GitHub Desktop.
Detect and migrate string properties of nodes to dedicated types
create (m:Mixed {createdAt: '2015-07-21T21:40:32.142+0100', name:'old'})
create (m:Mixed {createdAt: datetime(), name:'new'})
match (m:Mixed)
where apoc.meta.types(m).createdAt = 'STRING'
set m.createdAt = datetime(m.createdAt)
RETURN m
// See https://neo4j.com/docs/cypher-manual/current/functions/temporal/datetime/#functions-datetime-create-string
// for parsing options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment