What is the best way to migrate import/export v5 to v5

I’m just curious, what is the best way to migrate from one native v5 install to a fresh install on another server?

Would export then import via CSV within the app itself be viable, and would this bring over archived/deleted items or not?

I did it with v4 to v5, but that was a special case where InvoiceNinja did all the work. Thanks :grinning:

Hi,

If you’re moving from one selfhost install to another we recommend using mysqldump to copy over the database. You’ll also need to copy over the .env file and the storage folder if you’re using the documents feature.

1 Like

On top of what hillel suggests, without even bothering to reinstall anything you can also just zip the whole Invoice Ninja folder and unzip it on your new server, then make sure to create a database with the same user and password as the previous one and just import the backed up tables in it. That’s a bit dirtier than a clean install + imported data, but in my experience IN should still work right off the bat - the same install worked in my case at least on three different servers: a shared hosting running CloudLinux, a VPS running Almalinux 8 and another VPS running Ubuntu 20.04.

2 Likes

Thanks guys. That all makes perfect sense. Thanks @hillel and thank you for sharing your experiences too @charles, Charles, are you saying you are doing a mysqldump or did you export/import the tables with sql another way?

Also, any ideas on how to actually remove/delete some unwanted items? I have a “Test Client” that has racked up some invoices, payments, credits, etc., and even though the items are deleted, if I ever need to see deleted items things begin to clutter. I know now to make an image backup before experimenting, and then roll back after. However, it would be great to be able to actually purge those items once and for all that I can’t get rid of.

You can purge the individual client

1 Like

Well, my way of doing things might be a bit unorthodox. I have the UpdraftPlus WP plugin running on my WP install on the same server as my Invoice Ninja install, and it’s setup to backup my Invoice Ninja database every hour and then upload it to OneDrive in a .tar.gz file (pretty sure it’s by running mysqldump, but I never checked). Whenever I need to reset something in my database to a previous state, or just port some stuff over (it’s rare, but it happens), I just grab the appropriate backup on OneDrive and then import it directly in PHPmyadmin. If tables were previously existing in the database, I erase them first or the backup won’t overwrite them. Voilà, done :slight_smile: