Can I recover a deleted data table?

Hi there,

I have a couple of data tables in my app for caching database queries. I rather foolishly deleted the whole table instead of the data earlier, I know rookie mistake.
I recreated the table with the same columns and data types, but there was a link from a column in one table to a row in the deleted (and since recreated) table and that link is now broken and I’m struggling to re-link it. If I revert to an earlier version in version history do you know if it will restore the old table or is that outside of the bounds of version history?

Thank you in advance

No, the version control only manages the source code and a few text files with app settings.

The content of the data tables is not stored.

In cases like this it may help working with a server console, where you can test all your queries without writing code in the app and running the app. In some cases using the server console is much faster.

Well, I’m not concerned with the content of the data table, I just want the data table itself with it’s links to the other table restored. Will it do that?

No, that’s impossible.

The links to another table are something like “row X of table Y”.

If table Y doesn’t exist any longer and has been replaced by table Y2, and what was row X in the old table Y is now row X2 in the new table Y2, there is no way to know what’s what.

Try to download that table in csv format and see what’s inside. It will help you understand what kind of information is preserved.

I think you can’t even use that column, because it’s linked to a table that doesn’t exist. You will need to add a new column linked to the new table, see if you can populate it in some way, then delete the old broken column.

1 Like

Well I recreated the table with the exact same name and exact same column names. What I ultimately did to get it working was to delete the linked column from the table that I hadn’t deleted and recreated that column again, which then allowed me to link it again to the new table, which worked.

Thank you anyway.

You did what I described here :slight_smile:

Tables are not identified by name, they are identified by their number id. You could have two apps with two tables with the same name, but they will have different id.

Restoring data from a backup, esp. with linked rows, has so many case-by-case nuances, I really haven’t tried to write a general procedure. But at least you can have an off-line backup of your data, to refer to. Just do the backup before you make big changes.

Also search the Forum for other backup routines. IIRC, a newer one backs up to JSON, instead of SQLite.