Merging SQLite Databases


I’ve got two databases that I want to merge. Database A holds information which is up to date regarding player’s money and such. Database B holds old information but has some new tables added to it which are important. How would I go over merging Database A with Database B where A would be overwritten for existing tables but B’s tables which are not yet in A would be added to the new one (Database C). Also as a little exception to my first rule, perma- and removeprops data must be acquired from Database B.

My appreciation for any answers.

We need to know the exact structure of both databases in order to help

You mean you would need to see the whole Database? Sorry how would I exactly go over supplying you with the right info?

No, just need you to tell me the names of all the tables and what columns they have.

That’s not going to be a simple task.

I see… which tables so you need to add to the up-to-date database?

By the way, most SQL info you can find online would be relevant to you, just so you know. I’m happy to help of course, just thought I’d let you know that you’re not limited to facepunch :wink:

Yeah I know but this is applicable to Garry’s Mod so people might be more educated on GLua related stuff and SQLite database usage for Garry’s Mod specifically.

DarkRP tables need to come from Database A. Perma and RemoveProps need to come from Database B.
Several newly added tables need to be moved from B to A. That would then form C with

  • DarkRP data from A
  • Vehicle data from A
  • Prop data from B
  • New tables from B

[editline]26th February 2017[/editline]

Let’s just say I’d do it manually. How would I go over inserting tables from B into A?

Alright for anyone that reads this thread here’s my solution:
Turns out it’s way easier than you’d expect. Just get SQLite browser, open both databases and insert any tables you’d like to be in the other one by simply dragging and dropping. In case a table already exists you can remove that table and drag the desired one in to get the same effect.