Database migration to other existing site

I have 2 different sites on my production instance say site 1 and site2 . Both urls are being in use for some time now. We want to discontinue site 1 by migrating site 1 database to site 2 while retaining my exisiting data on site 2.

Expectation is after migration, Both site 1 and site 2 data to be available on site 2. How can I achieve this without loosing any data.

Any help is greatly appreciated.

Hello :wave:, so you want to merge two databases.

What are the kinds of data in your databases currently that you want to migrate/merge?

  • Settings such as System Settings
  • Core data such as Users
  • Master data such as Items, Item Groups
  • Transactions (quotations, orders, invoices, payments)
  • Accounting transactions (GL Entries, Payment Ledger entries)
  • Module specific data: HRMS Employees, …

What is your merging strategy for the above-mentioned elements?

  • Ignore old records from site 1
  • Replace all records from site 2
  • Overwrite existing data when identifiers are the same
  • Merge by keeping unique identifiers
  • Merge by generating new identifiers

Thanks for your response.
The Kind of data I want to migrate is basically any master data, users, invoices and accounting / stock ledgers from site1 to site 2.

As of merging strategy I do not have much idea on this, all I want is data on site 1 to be present on site 2 while retaining my configuration on site 2 to remain same, and both data from site 1 and site 2 to be present on site 2.

Okay, is there a specific invoice numbering format for each site?

Example : SINV-SITE_1-2024-0001 for site 1 and SINV-SITE_2-2024-0001 for site 2?

Same for orders, items, … ?


If not critical, maybe it’s possible to wait for the end of the year and just not import orders, ledgers. Basically make an opening entry for accounting, stocks, … without importing the “history” documents (invoices)

To be fair, it’s going to be difficult to import the full history unless the documents have strictly different names with no overlap :sweat_smile:

okay, you have highlighted very important point. I’ll make sure to check naming series. In my case we stopped using site 1 and started using site 2 with fresh start. We want to update old data as well in new site. Assuming there wont be any overlapping, how do you suggest to proceed on this.

This is very good news I think.

The first thing I would do is to make a third site by restoring a backup of site 2, then trying to do the migration on this third site, just as a training step.

As for the migration steps, I’m not 100% sure that the standard Data Import Tool can work for all the documents, but it’s worth giving it a try.

It might also be possible to do partial database restores on the command line, without removing the existing data. bench partial-restore