Hi,
I accidentally deleted all the data from my main branch. To recover it, I created a new branch off the main branch, using the old timestamp. The data only exists in the new branch now. I would like to move it back to the main branch, but I’m not an expert in databases. How can I do this?
Thanks
Hey @dong-qian
Since each branch has its own compute endpoint, you can follow this guide to move data between branches Import data from PostgreSQL — Neon Docs
The source database will be the newly created branch, and the target database will be the main branch.
Alternatively, you can also just use the newly created branch instead of main and set it as the primary branch
Thanks for your prompt response. I will use the alternative method. As I can’t delete the main branch, I won’t be able to rename the new branch to “main”. I’ll just call it “Prod”.
The only downside is that I’ll need to make code changes to use the new connection string. However, this won’t happen often, so it’s not a major issue.
Thanks!
No problem! If you have any questions or run into any other issues, feel free to share them here