Merge lp:~nkarageuzian/mailman/pg_update into lp:mailman

Proposed by nicolask
Status: Rejected
Rejected by: Barry Warsaw
Proposed branch: lp:~nkarageuzian/mailman/pg_update
Merge into: lp:mailman
Diff against target: 129 lines (+120/-0)
2 files modified
src/mailman/database/schema/mm_20131007000000.py (+45/-0)
src/mailman/database/schema/mm_20131203000000.py (+75/-0)
To merge this branch: bzr merge lp:~nkarageuzian/mailman/pg_update
Reviewer Review Type Date Requested Status
Barry Warsaw Pending
Review via email: mp+197519@code.launchpad.net

Description of the change

Added postgreSQL schema upgrade scripts

To post a comment you must log in.
lp:~nkarageuzian/mailman/pg_update updated
7233. By nicolask

fixing update tag

Revision history for this message
Barry Warsaw (barry) wrote :

Thanks for the contribution and apologies for not reviewing this earlier. I'm only rejecting it now because the port to SQLAlchemy obsoletes it.

Unmerged revisions

7233. By nicolask

fixing update tag

7232. By Nico <email address hidden>

Postgresql migration scripts (for https://bugs.launchpad.net/mailman/+bug/1236297 and for listarchivers patch)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'src/mailman/database/schema/mm_20131007000000.py'
--- src/mailman/database/schema/mm_20131007000000.py 1970-01-01 00:00:00 +0000
+++ src/mailman/database/schema/mm_20131007000000.py 2013-12-31 11:55:54 +0000
@@ -0,0 +1,45 @@
1# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
2#
3# This file is part of GNU Mailman.
4#
5# GNU Mailman is free software: you can redistribute it and/or modify it under
6# the terms of the GNU General Public License as published by the Free
7# Software Foundation, either version 3 of the License, or (at your option)
8# any later version.
9#
10# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13# more details.
14#
15# You should have received a copy of the GNU General Public License along with
16# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
17
18"""3.0b3 -> 3.0b4 schema migrations.
19
20Type changes:
21 * mailinglist.moderator_password: TEXT -> BYTEA
22"""
23
24from __future__ import absolute_import, print_function, unicode_literals
25
26__metaclass__ = type
27__all__ = [
28 'upgrade',
29 ]
30
31
32VERSION = '20131007000000'
33
34
35
036
37def upgrade(database, store, version, module_path):
38 if database.TAG == 'sqlite':
39 return
40 store.execute("""
41 ALTER TABLE mailinglist ALTER COLUMN moderator_password TYPE BYTEA
42 USING convert_to(moderator_password, 'SQL_ASCII');
43 """)
44 # Record the migration in the version table.
45 database.load_schema(store, version, None, module_path)
46
147
=== added file 'src/mailman/database/schema/mm_20131203000000.py'
--- src/mailman/database/schema/mm_20131203000000.py 1970-01-01 00:00:00 +0000
+++ src/mailman/database/schema/mm_20131203000000.py 2013-12-31 11:55:54 +0000
@@ -0,0 +1,75 @@
1# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
2#
3# This file is part of GNU Mailman.
4#
5# GNU Mailman is free software: you can redistribute it and/or modify it under
6# the terms of the GNU General Public License as published by the Free
7# Software Foundation, either version 3 of the License, or (at your option)
8# any later version.
9#
10# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13# more details.
14#
15# You should have received a copy of the GNU General Public License along with
16# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
17
18"""3.0b3 -> 3.0b4 schema migrations.
19
20Type changes:
21 * bounceevent.list_id (NEW COLUMN)
22 * per list archiver (NEW TABLE)
23"""
24
25from __future__ import absolute_import, print_function, unicode_literals
26
27__metaclass__ = type
28__all__ = [
29 'upgrade',
30 ]
31
32
33VERSION = '20131203000000'
34
35
36
037
38def upgrade(database, store, version, module_path):
39 if database.TAG == 'sqlite':
40 return
41 store.execute("""
42CREATE TABLE bounceevent_backup (
43 id SERIAL NOT NULL,
44 email TEXT,
45 "timestamp" TIMESTAMP,
46 message_id TEXT,
47 context INTEGER,
48 processed BOOLEAN,
49 PRIMARY KEY (id)
50 );
51 """)
52 store.execute("""
53INSERT INTO bounceevent_backup SELECT
54 id, email, "timestamp", message_id,
55 context, processed
56 FROM bounceevent;
57 """)
58 store.execute("""
59ALTER TABLE bounceevent_backup ADD COLUMN list_id TEXT;
60 """)
61 store.execute("""
62CREATE TABLE listarchiver (
63 id SERIAL NOT NULL,
64 mailing_list_id INTEGER NOT NULL,
65 name TEXT NOT NULL,
66 _is_enabled BOOLEAN,
67 PRIMARY KEY (id)
68 );
69 """)
70 store.execute("""
71CREATE INDEX ix_listarchiver_mailing_list_id
72 ON listarchiver(mailing_list_id);
73 """)
74 # Record the migration in the version table.
75 database.load_schema(store, version, None, module_path)
76