DB corruption after a directly copy of the DB files

Hi everyone,

I had version 1.5.9 running on a docker environment, but had a problem not related with InvoicePlane. The thing is that I didn’t have a backup of the DB, and finally I could copy the files of the DB directly from the directory (/var/lib/mysql/my_db).

Now I have same version runing on a normall installation. An I can access to the app and see the values of DB, but when I try to access to the links (invoices and clients), I had this error:

Can you help to fix it, any idea?

There is two tables that “doesn’t” exists in engine:

  • ip_invoice_custom
  • ip_client_custom

And both tables have they’re .frm and .idb file on the directory of the DB.

And both tables have they’re .frm and .idb file on the directory of the DB.

Personally i would place those 2 files in a separate directory, they’re your last step of recovery

Install complete empty InvoicePlane in a new, empty database.
Copy over those 2 tables using your favorites database edit tool, (i always use phpMyAdmin)

With those extra 2 tables copied over you won’t have this error anymore

Now… depending on whether you had values in your old database in your custom_values for your custom_fields, do the following:

  • Backup the new recovered database, without custom values
  • Backup the empty database, you might need it some day
  • Copy your recovered .frm and .ibd files in that new, empty database (maybe remove the old files for those 2 tables)
  • Check phpMyAdmin to see if your custom values tables are there
  • Check the rights of those 2 files
  • Try to recover

if you have your values back, copy them over to your clean, recovered database
And of course re-backup your new, recovered database

Fixed!!! thank you very much. At the end, all *_custom tables were broken. I changed via phpMyAdmin with a empty ones of a DB fresh install.
For the moment I don’t see missing data, but I have a backup copy of those tables in case I need it.

1 Like

Ok, just to complete things:

  • If you’re running locally without Linux, set an alarm clock to make backups :wink:
  • If you’re running Locally on Mac or on Linux, make a “cron job” to make backups
  • If you’re running on a server with Linux set a cron job as well

I hope you’ve got your Docker back
You could do:
docker exec -it $(name-of-docker-container) bash -c "mysqldump param param param"
And that creates your backup every time you let your cron job run

Upgrading to InvoicePlane v1.6.4 or 1.7.0

Take some coffee, it’s going to take a while:

  • You’re missing versions 1.5.10 through 1.6.4
    That’s 8 versions
  • Howeverrrrr… 1.6.0 is important and 1.6.2 is important

In 1.6.0 you’ll definitely run into some problems, so take extra time for that.
Version 1.6.2 has database updates, so don’t skip that one.

You can go to 1.6.0 directly. I haven’t done it, but you can do it.

From 1.6.0 you can go directly to 1.6.2, since that’s a database update, so you need to go to /setup afterwards

From 1.6.4 you can go to 1.6.4, but wait for 1.6.5 instead. It’s on its way

Compatibilities:

  • Version 1.5.9 => compatible with PHP 5.x :man_shrugging:
  • Version 1.6.0 till 1.6.4 and 1.6.5 => compatible with PHP 7.x :man_shrugging:
  • Version 1.7.0 (and 1.7.1) => compatible with PHP 8.x :grinning: