Se rendre au contenu

Rebuild Staging Database Without Loosing Data

Stop losing testing data when the odoo.sh staging branch expire
30 septembre 2026 par
Rebuild Staging Database Without Loosing Data
Clovis de Bontin
| Aucun commentaire pour l'instant

“This staging build will be deleted on [date].” 

A few months ago, Odoo reduced the lifespan of the staging odoo.sh branches from 3 months to 1 months. Among Odoo partners, this has created a lot of frustrations. Especially in projects with slow customers. 

Indeed, it is not rare that some customers take more than 1 month to QA and give us feedback. So the new window is sometimes too short. And once the staging branch expired, it is lost. And if there were configurations and customization currently being tested, they are destroyed. And then, the staging branch can only be restored as a copy of the production environment.


This staging build will be deleted on [date]


But there's actually a way to rebuild the staging branch, extend its validity period by 1 month, and reload the staging data. Let's see how.


Create a backup of the staging branch

In odoo.sh, make sure to select the staging branch that is about to expire.

select the staging branch in odoo.sh

Go in the BACKUPS section and create a backup. Wait a bit ; odoo.sh may take a few minutes to create your backup. The bigger your database, the longer it will take.

odoo.sh tabs, with backups tab selected

Once the backup is created, download it. You have a few options here. The type of dump, and whether or not to include the filestore.

backup options in odoo.sh

For the type of dump, both will achieve the goal of extending the deletion date. But downloading a neutralized database with deactivate crons, disable outgoing mail, force payment and shipping configuration to test mode. Maybe you want that, but here the goal is only to extend the deletion date, without altering anything in the database. Which is why I suggest selecting "Exact database dump". Remember, we are working on staging, which is already in a neutralized state. So downloading an exact dump will not conflict with existing databases. 

For the filestore, it is up to you. Both will successfully extend the deletion date. But if you are working with a massive database, restoring the filestore may be overkill. Though, if you do not include them in the dump, the user experience will be impacted, as no logo or image will be loaded. And depending on the workflows you are testing, images, files and whatnot may be required.

Rebuild the staging branch

You can do that from the Branches tab, or the Builds one.

From the Branches tab, drag the staging branch in the Development section, then back in the Staging section. Or by clicking "Rebuild" from the top right corner of the window. 

rebuild the staging branch from the branches tab

From the Builds tab, just click "Rebuild" on the staging branch.

rebuild the staging branch from the builds tab


Load the backup

Once the build is successful, go back in the BACKUP section (ensure the staging branch is still the one selected in the left pannel), and import the dump you downloaded earlier.

import a database backup in odoo.sh

A popup appears. Click "Next". Then import the backup downloaded earlier through your browser, or by SSH if the database is over 2GB. odoo.sh gives you all the instructions you need to process this step.

Click on "Import", wait for the build to succeed, and there you go! The deletion date changed, and the database is exactly as it was. No data or configuration has been lost.


Conclusion

In my memories, following this process would actually include the deletion date in the dump, and would therefore do nothing to extend the database's lifespan. After testing this process myself, I discovered that either my memories were wrong, or Odoo actually heard the complaints, and provided us a workaround. 

Regardless, we have a way to extend the deletion date of staging branches on odoo.sh.

Thanks for reading, if you have any question, feel free to email me at: louis@cdb.solutions or DM me on LinkedIn.

Se connecter pour laisser un commentaire.
Connect ChatGPT And Other AIs to Odoo Agents
How my interaction with a billionaire turned into an opportunity for the Odoo community