简体   繁体   中英

Restoring a part of a production db backup

Recently an object and its associated objects(maybe 600 rows in a bunch of tables) were deleted from my production. I have a backup of my data from back when the data was mostly there, and I would like to restore it.

What would be the cleanest/easiest way to do this?

This is a mysql dump so I can easily restore to my dev box, but then what? I am hoping for a command or 2 that generates either SQL or ruby code i can pop into a migration.

Edit: Just came across https://github.com/rroblak/seed_dump looks promising

Ended up using seed_dump. Despite it being undocumented, it can dump arbitrary relations and not just entire models, so all I had to do was assemble the right relations and dump them in the rails console with SeedDump.dump(<relation>, <options>) to get a seeds file of just the rows I wanted, which I could then restore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM