← Back to team overview

openupgrade-drivers team mailing list archive

Re: [Question #227528]: Help for working in migration 6.1 -> 7.0

 

Question #227528 on OpenUpgrade Server changed:
https://answers.launchpad.net/openupgrade-server/+question/227528

    Status: Open => Answered

Holger Brunn (Therp) proposed the following answer:
Hi Sylvain,

thanks for your interest! I assume you already read http://openupgrade-
server.readthedocs.org/en/latest/ ?

So the general idea is to provide migrations scripts for every addon in
its migrations/[version] directory. This already happened for the base
module in openupgrade-server's 7.0 branch. It has yet to be done for the
addons in openupgrade-addons' 7.0 branch.

You will find a file named "openupgrade_analysis.txt" which helps you to
decide what to do: Which fields are added, which ones removed, etc.

Then you can start coding: Do as much as you can in post-migration.py,
resort to pre-migration.py when necessary. As the names indicate, the
first is run after the migration, the second before. Before migration,
you can assume the database to be unchanged (OpenERP has not yet created
new fields and deleted old ones) but you have no access to the ORM, so
you need to work directly on the database. After the migration, the ORM
is available but old columns are dropped and field types changed for
example. So it depends a lot on the module you're working on where the
good place to do the work is. In your migration scripts, you can import
openerp.openupgrade which provides some helper functions like renaming
columns.

So to start working in a nutshell:
bzr branch lp:openupgrade-server
bzr branch lp:openupgrade-addons
[hack hack hack]
openupgrade-server/openerp/openerp-server --update=base,[the module(s) you worked on] --stop-after-init --database=[a copy of your 6.1 database] --addons-path=openupgrade-addons

It is crucial to point to openupgrade's addons path and not the original
ones. This will take a while, you need to inspect your logfile closely
and if everything went right, you have a database usable with 7.0 (of
course, only the parts for which migrations scripts exist)

Please don't forget to share your results, propose a merge on
openupgrade-addons then.

-- 
You received this question notification because you are a member of
OpenUpgrade Drivers, which is an answer contact for OpenUpgrade Server.