Forums

Messed up Database

Hello, I messed up big time my database. I did something with git and when I tried to run my migrations I actually deleted everything stored in my database. Can you please restore my data inside my database from 3/23/2021 at 23:00 PM? Or try to give me the backup dumpdata file so I can load the data back into my database. I would highly appreciate it because I can't afford to lose my data.

I saw that it is possible on this post: https://www.pythonanywhere.com/forums/topic/2167/

Ok but, like the other thread mentioned, it can take around 24 hours. Let us know the timezone for the 23h00.

Timezone is (GMT+2), doesn't really matter what the time is because any version from 3/23/2021 will do. I can wait, no problem if you can get it done. Thank you very much!

OK, we will take care of it and let you know when it's done.

Great, thank you!

Hmm -- the post that you linked to is specifically about recovering MySQL databases, but the restore of your MySQL database from 23 March is completely empty -- no tables or data.

I see that you do appear to have a SQLite database inside your account, so we'll see if we can get a version of that from 23 March.

I wasn't using SQLite in production, only on localhost and that s a different thing. It can't be empty, can you try maybe to see if there are any tables and data on 22 March or one day earlier?

I did python manage.py migrate which I think erased all my data, if this information is helpful.

Sure, we can try the 22nd, but it does take significant time to restore a database.

I understand and I imagine that it takes time, the thing is it that is impossible that the tables are empty, the data must have been stored somewhere.

Honestly I don't really understand why it got erased. I did git pull, there were some errors in settings.py, did git stash apply to go back and then I ran my migrations because It said that the tables didn't exist. What happend there?

The database for the 22nd was also empty. At this stage, it looks like you never had any data in your MySQL database.

It is impossible. Maybe it is all empty because I created on 24th a new database, which basically was empty in all of the other days because it overwrote the data which I am looking for. Is there any way for example where you have a backup of my database from any date different from 24th March?

It is clearly possible, because that is what we have seen. If you'd overwritten the data on the 24th, then the backups that we've already looked at (22nd and 23rd) would have had data in them.

.

I understand, I have one more request. Can you look into my web app files from 22th March and specifically into the /home/nxtlevel/backend-nxt-level-v2/dbnxtlevel/settings.py file and tell me what database I was using? I want to know the database name.

Hi, we don't have an instant insight into previous state of your files, so we need to actually restore them. We can look at this on Monday. (Btw. maybe consider using a version control system, to prevent situations like that in the future?)

Ok, I can wait until Monday. Definitely going to make a script that will back me up after this.

You were using sqlite. We have recovered the sqlite database file that was being used on 23 March into your home directory as db.sqlite3_RECOVERED

Omg thank you very much, it finally worked! You guys are awesome! :)

Glad to hear that!