SenCodeMaker / whatsapp-database-merger

SQL scripts to merge two or more whatsapp database easily
GNU General Public License v3.0
5 stars 2 forks source link

whatsapp-database-merger

SQL scripts to merge two (or more) whatsapp (decrypted) database with ease and performance. It basically take the data in the newest and put it on top of the pile in the older.

The resulting database will also be in decrypted. To use it, it must either be moved to /data/data/com.XXwhatsapp/databases on a rooted phone, or otherwise encrypted again and restored as usual in /com.XXwhatsapp/databases.

Usage

Download the scripts up here.

The easy way is to open your databases in dbeaver

Database > new connexion > sqlite > open : select the db file

open new file (ctrl + O) > open each script > for each script connect it to the right base > click N/A up in the bar

Update the path to the db files in the scripts.

Execute each script (Alt + X or clic button)

Right click on the destination database, which I name the "oldest" in the script, and disconnect it. Close dbeaver, normaly next to your dbs the file named db_wal.db should be emptied.

Your destination base is ready for restoration.

Comparison, limitations & to-do list

In comparison to natario's merger this way should not abandon data or encounter problem for large message content. It also runs in seconds compared to hours with natario's on my dbs.

The dbs are supposed to not be overlapping. Message duplication would appear if it's not the case.To avoid it removing duplicates is necessary in the new db.

Tables user_device and jid are not well handled, it creates duplicate for couples of user/device. I didn't see it bring an issue in app use. Improving it would need to think about ow to map user/device from the new base to the old. Existing couples should be dropped, couple with corresponding to new device for the existing user should increments key_index column.