Merge lp:~therp-nl/banking-addons/ba70-fix_migration into lp:banking-addons

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 183
Proposed branch: lp:~therp-nl/banking-addons/ba70-fix_migration
Merge into: lp:banking-addons
Diff against target: 117 lines (+75/-10)
3 files modified
account_banking/migrations/7.0.0.1/pre-migration.py (+33/-0)
account_direct_debit/migrations/7.0.2/post-migration.py (+38/-0)
account_direct_debit/migrations/7.0.2/pre-migration.py (+4/-10)
To merge this branch: bzr merge lp:~therp-nl/banking-addons/ba70-fix_migration
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Review via email: mp+176703@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

The migrations from the branches you renamed never ran then, right?

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

No, they run at every migration, that is the problem ;-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== renamed directory 'account_banking/migrations/0.1.81' => 'account_banking/migrations/6.1.0.1.81'
=== added directory 'account_banking/migrations/7.0.0.1'
=== added file 'account_banking/migrations/7.0.0.1/pre-migration.py'
--- account_banking/migrations/7.0.0.1/pre-migration.py 1970-01-01 00:00:00 +0000
+++ account_banking/migrations/7.0.0.1/pre-migration.py 2013-07-24 14:53:33 +0000
@@ -0,0 +1,33 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Therp BV (<http://therp.nl>).
5# All Rights Reserved
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22def migrate(cr, version):
23 if not version:
24 return
25
26 # workflow state moved to another, new module
27 cr.execute(
28 """
29 UPDATE ir_model_data
30 SET module = 'account_banking_payment'
31 WHERE name = 'trans_done_sent'
32 AND module = 'account_direct_debit'
33 """)
034
=== renamed directory 'account_banking_nl_clieop/migrations/0.63' => 'account_banking_nl_clieop/migrations/6.1.0.63'
=== renamed directory 'account_banking_nl_clieop/migrations/0.64' => 'account_banking_nl_clieop/migrations/6.1.0.64'
=== added file 'account_direct_debit/migrations/7.0.2/post-migration.py'
--- account_direct_debit/migrations/7.0.2/post-migration.py 1970-01-01 00:00:00 +0000
+++ account_direct_debit/migrations/7.0.2/post-migration.py 2013-07-24 14:53:33 +0000
@@ -0,0 +1,38 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2013 Therp BV (<http://therp.nl>).
5#
6# All other contributions are (C) by their respective contributors
7#
8# All Rights Reserved
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU Affero General Public License as
12# published by the Free Software Foundation, either version 3 of the
13# License, or (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU Affero General Public License for more details.
19#
20# You should have received a copy of the GNU Affero General Public License
21# along with this program. If not, see <http://www.gnu.org/licenses/>.
22#
23##############################################################################
24
25def migrate(cr, version):
26 if not version:
27 return
28 cr.execute(
29 """
30 UPDATE payment_line
31 SET transit_move_line_id = banking_addons_61_debit_move_line_id
32 """)
33 cr.execute(
34 """
35 ALTER TABLE "payment_line"
36 DROP COLUMN "banking_addons_61_debit_move_line_id"
37 """
38 )
039
=== modified file 'account_direct_debit/migrations/7.0.2/pre-migration.py'
--- account_direct_debit/migrations/7.0.2/pre-migration.py 2013-05-28 14:17:56 +0000
+++ account_direct_debit/migrations/7.0.2/pre-migration.py 2013-07-24 14:53:33 +0000
@@ -22,6 +22,9 @@
22#22#
23##############################################################################23##############################################################################
2424
25import logging
26logger = logging.getLogger()
27
25def rename_columns(cr, column_spec):28def rename_columns(cr, column_spec):
26 """29 """
27 Rename table columns. Taken from OpenUpgrade.30 Rename table columns. Taken from OpenUpgrade.
@@ -41,17 +44,8 @@
41 if not version:44 if not version:
42 return45 return
4346
44 # workflow state moved to another module
45 cr.execute(
46 """
47 UPDATE ir_model_data
48 SET module = 'account_banking_payment'
49 WHERE name = 'trans_done_sent'
50 AND module = 'account_direct_debit'
51 """)
52
53 # rename field debit_move_line_id47 # rename field debit_move_line_id
54 rename_columns(cr, {48 rename_columns(cr, {
55 'payment_line': [49 'payment_line': [
56 ('debit_move_line_id', 'transit_move_line_id'),50 ('debit_move_line_id', 'banking_addons_61_debit_move_line_id'),
57 ]})51 ]})

Subscribers

People subscribed via source and target branches

to status/vote changes: