Schema Migration via GraphQL

You can do a migration with upsert block e.g:

upsert {
  query {
    v as var(func: has(Person.name)) {
      a as Person.name
    }
  }

  mutation {
    # we copy the values from the old predicate
    set {
      uid(v) <Person.username> val(a) .
    }

    # and we delete the old predicate - this is optional
    delete {
      uid(v) <Person.name> * .
    }
  }
}
2 Likes