Restore specific records which are deleted from production
Hello 👋
In this article, we will learn how to restore some data removed from the production database.
Most of the learnings give us the ability to restore the entire database or restore the entire table. But imagine that you deleted some specific records from different tables. For example, you removed two orders from the database according to related records too.
First, we will locate the exact date of data loss. For example ten days ago. So we get the backup on this date and restore that backup in a different database.
Now we have two databases. First is our production database and second, will be our restored database which the deleted records living in this database.
Let’s find the order, I am using Postico to connect our PostgreSQL database.
and after the query is executed we directly export the results into a CSV file.
after doing that we should have to connect our production database and we will import these exported data into our production database.
We must select the “First row is header” option and we must choose the target table correctly.
Finally, we decide match column strategy. I am selecting the Match columns by name option and Postico says “X of x columns selected for import”
If you have empty columns that you don’t want to import. You can select the “Do not import” option for every column.
after this selection let’s hit the import button and wait with our fingers crossed.
If you see this notification above then you have successfully imported your data into the production database.