mrjgreen/db-sync

Question: The table ... does not have a primary key

Closed this issue · 1 comments

Hi @mrjgreen,

I'm really happy with your tool. It works really great by now.
The only problem I experience is related to tables without a primary key.

There I get the following error:
The table ... does not have a primary key

Is it necessary to have a primary key in case of comparing the tables?
Or is there a possibility to sync without.
It would also be ok if I could tell the tool to simply overwrite all the rows in target_db.table by source_db.table without comparing, if there is no primary key.

Thank you!

This seems to be a duplicate of #7
Sorry to copy paste, but here is the response from the last time this was asked:

Firstly... Every table should probably have a key :)

The tool uses insert on duplicate key update to insert or update the row on the remote server. In theory if the table had a unique key that wasn't the primary it would work. But I'm not sure I see the reasoning.

What's the use case?