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
1=== renamed directory 'account_banking/migrations/0.1.81' => 'account_banking/migrations/6.1.0.1.81'
2=== added directory 'account_banking/migrations/7.0.0.1'
3=== added file 'account_banking/migrations/7.0.0.1/pre-migration.py'
4--- account_banking/migrations/7.0.0.1/pre-migration.py 1970-01-01 00:00:00 +0000
5+++ account_banking/migrations/7.0.0.1/pre-migration.py 2013-07-24 14:53:33 +0000
6@@ -0,0 +1,33 @@
7+# -*- coding: utf-8 -*-
8+##############################################################################
9+#
10+# Copyright (C) 2013 Therp BV (<http://therp.nl>).
11+# All Rights Reserved
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+def migrate(cr, version):
29+ if not version:
30+ return
31+
32+ # workflow state moved to another, new module
33+ cr.execute(
34+ """
35+ UPDATE ir_model_data
36+ SET module = 'account_banking_payment'
37+ WHERE name = 'trans_done_sent'
38+ AND module = 'account_direct_debit'
39+ """)
40
41=== renamed directory 'account_banking_nl_clieop/migrations/0.63' => 'account_banking_nl_clieop/migrations/6.1.0.63'
42=== renamed directory 'account_banking_nl_clieop/migrations/0.64' => 'account_banking_nl_clieop/migrations/6.1.0.64'
43=== added file 'account_direct_debit/migrations/7.0.2/post-migration.py'
44--- account_direct_debit/migrations/7.0.2/post-migration.py 1970-01-01 00:00:00 +0000
45+++ account_direct_debit/migrations/7.0.2/post-migration.py 2013-07-24 14:53:33 +0000
46@@ -0,0 +1,38 @@
47+# -*- coding: utf-8 -*-
48+##############################################################################
49+#
50+# Copyright (C) 2013 Therp BV (<http://therp.nl>).
51+#
52+# All other contributions are (C) by their respective contributors
53+#
54+# All Rights Reserved
55+#
56+# This program is free software: you can redistribute it and/or modify
57+# it under the terms of the GNU Affero General Public License as
58+# published by the Free Software Foundation, either version 3 of the
59+# License, or (at your option) any later version.
60+#
61+# This program is distributed in the hope that it will be useful,
62+# but WITHOUT ANY WARRANTY; without even the implied warranty of
63+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64+# GNU Affero General Public License for more details.
65+#
66+# You should have received a copy of the GNU Affero General Public License
67+# along with this program. If not, see <http://www.gnu.org/licenses/>.
68+#
69+##############################################################################
70+
71+def migrate(cr, version):
72+ if not version:
73+ return
74+ cr.execute(
75+ """
76+ UPDATE payment_line
77+ SET transit_move_line_id = banking_addons_61_debit_move_line_id
78+ """)
79+ cr.execute(
80+ """
81+ ALTER TABLE "payment_line"
82+ DROP COLUMN "banking_addons_61_debit_move_line_id"
83+ """
84+ )
85
86=== modified file 'account_direct_debit/migrations/7.0.2/pre-migration.py'
87--- account_direct_debit/migrations/7.0.2/pre-migration.py 2013-05-28 14:17:56 +0000
88+++ account_direct_debit/migrations/7.0.2/pre-migration.py 2013-07-24 14:53:33 +0000
89@@ -22,6 +22,9 @@
90 #
91 ##############################################################################
92
93+import logging
94+logger = logging.getLogger()
95+
96 def rename_columns(cr, column_spec):
97 """
98 Rename table columns. Taken from OpenUpgrade.
99@@ -41,17 +44,8 @@
100 if not version:
101 return
102
103- # workflow state moved to another module
104- cr.execute(
105- """
106- UPDATE ir_model_data
107- SET module = 'account_banking_payment'
108- WHERE name = 'trans_done_sent'
109- AND module = 'account_direct_debit'
110- """)
111-
112 # rename field debit_move_line_id
113 rename_columns(cr, {
114 'payment_line': [
115- ('debit_move_line_id', 'transit_move_line_id'),
116+ ('debit_move_line_id', 'banking_addons_61_debit_move_line_id'),
117 ]})

Subscribers

People subscribed via source and target branches

to status/vote changes: