About migration

dgraph use uid to store the relations between nodes, when migrate to another database, all the uids will re-generate, so all the relations will disappear? in that way, for migration, I should use x-id as id?

Doesn’t export/import or backup/restore account for this. These are the proper ways to migrate data. What is your migration process?

I’m assuming “to another database” you mean another Dgraph instance, right?

yes, all of them are dgraph.

the situation is, by now, I just use the instance in my own machine. I wonder if I migrate it to the cloud in the future, all the relations will keep the same, or what should I do for this situation.

If you do a full backup of local and restore to the cloud then you should have the same uids.

I know when they launched the namespaces in the cloud I had this same concern and I copied all uids for existing nodes to an xid field but when the support migrated my instance they were able to keep all my same uids in tact.