dimanche 1 février 2015

Safe and fast way to merge many SQLite databases

I have a situation where I have more than 5 SQLite databases which have completely the same schema but were populated on different sources. Now I need to merge them and create one big database.


The problem is that database has many tables which are connected with foreign keys and in each database tables which are foreign keys have ids which start from 1,2,3... That means a lot of data will have duplicated id's.


That would be the safest and fastest way to merge those databases, generate different ids for tables which will be merged and adjust those foreign keys in those tables which depend on them?


I was thinking to write a code to recalculate the ids and change values but maybe there is a faster and simpler way.


Aucun commentaire:

Enregistrer un commentaire