Merge lp:~pedro.baeza/openupgrade-addons/6.1-fetchmail into lp:openupgrade-addons/6.1

Proposed by Pedro Manuel Baeza
Status: Merged
Merged at revision: 6619
Proposed branch: lp:~pedro.baeza/openupgrade-addons/6.1-fetchmail
Merge into: lp:openupgrade-addons/6.1
Diff against target: 56 lines (+52/-0)
1 file modified
fetchmail/migrations/6.1.1.0/pre-migration.py (+52/-0)
To merge this branch: bzr merge lp:~pedro.baeza/openupgrade-addons/6.1-fetchmail
Reviewer Review Type Date Requested Status
Paulius Sladkevičius @ hbee (community) Approve
Stefan Rijnhart (Opener) Approve
Review via email: mp+133469@code.launchpad.net

Commit message

[ADD] Migration script for module 'fetchmail'.

Description of the change

[ADD] Migration script for module 'fetchmail'.

To post a comment you must log in.
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) wrote :

I found that selection field 'state' on the 6.0 - draft, waiting, done, but 6.1 have 2 only draft, done, I suggest to map 'waiting' to 'draft'.

review: Needs Fixing
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Pedro,

this proposal is set to 'Work in progress', which is why it did not get reviewed earlier on. Does it need any more work as far as you are concerned?

From my part, please use the @migrate decorator to replace the try/catch block, the logging part and the version check. And Paulius' suggestion looks good to me too.

review: Needs Fixing
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Stefan and Paulius,

Thanks for your reviews. I was very newbie when I made this MP, so please excuse me if I did something wrong in the MP status.

I have made the changes you have proposed. Please check them.

Regards.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thank you Pedro! To finish it off, you can remove the now unsed imports of os, logging and osv from the file. l.31 is now unused too, and I would appreciate if you could break up lines 9 and 48 to respect PEP max. line length.

review: Needs Fixing
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi again, Stefan,

Thank you very much for your appreciations. I'm a little unaware of this details, but I will try to take in care for future apports.

Regards.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks for the changes!

review: Approve
Revision history for this message
Paulius Sladkevičius @ hbee (komsas) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'fetchmail/migrations/6.1.1.0/pre-migration.py'
--- fetchmail/migrations/6.1.1.0/pre-migration.py 1970-01-01 00:00:00 +0000
+++ fetchmail/migrations/6.1.1.0/pre-migration.py 2013-07-18 10:21:25 +0000
@@ -0,0 +1,52 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
6# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.openupgrade import openupgrade
24
25me = __file__
26
27column_renames = {
28 'mail_message': [
29 ('server_id', 'fetchmail_server_id'),
30 ],
31 }
32
33table_renames = [
34 ('email_server', 'fetchmail_server'),
35 ]
36
37model_renames = [
38 ('email.server', 'fetchmail.server'),
39 ]
40
41def _change_waiting_state(cr):
42 openupgrade.logged_query(cr, "UPDATE fetchmail_server \
43 SET state='draft' \
44 WHERE state='waiting'")
45
46@openupgrade.migrate()
47def migrate(cr, version):
48 if openupgrade.table_exists(cr, 'email_server'):
49 openupgrade.rename_tables(cr, table_renames)
50 openupgrade.rename_columns(cr, column_renames)
51 openupgrade.rename_models(cr, model_renames)
52 _change_waiting_state(cr)

Subscribers

People subscribed via source and target branches