Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
6619 Visualizzazioni

I am writing custom addons for my company. Over their life these
addons will accumulate data in the tables I have modelled, using the
orm.

During development, when I want to update the schema I have to
uninstall and reinstall the addon. It will drop all the tables and
recreate them.

The question is, when I am deploying a new version of an addon to
product (because it has new features which need new table columns,
etc), how do I safely preserve and migrate the production data to the
new schema without losing it?

 

Edit:

I can't comment on Baiju's answer because it requires 50 karma. Anyway Baiju, thanks. I take your answer to mean that Odoo will automatically add new tables to the database based on any new fields added when I upgrade a module. I will make sure to back it up just to be safe, but this was the answer I was looking for.

Avatar
Abbandona
Risposta migliore

Hi, Darrel

If you want to add a new field to an object, you can do that without losting data, only thing you have to take care is don't uninstall the module. If you you uninstall the module all your data in that object will be lost.

To add an extra field to an object you can simply modify your .py file and .xml file in your module and save that then;-

1. Restart your odoo server

2. Upgrage your module (Settings==> select module==> click upgrade

Now you can see the changes you made without losting data.

Avatar
Abbandona
Risposta migliore

The first thing you have to do, is to backup your database (just is case .. !), and after that, install or uninstall your new module as usual.

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 15
5179
1
mar 15
4464
1
feb 25
1098
1
lug 22
7358
0
nov 16
5260