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
1=== added file 'src/mailman/database/schema/mm_20131007000000.py'
2--- src/mailman/database/schema/mm_20131007000000.py 1970-01-01 00:00:00 +0000
3+++ src/mailman/database/schema/mm_20131007000000.py 2013-12-31 11:55:54 +0000
4@@ -0,0 +1,45 @@
5+# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
6+#
7+# This file is part of GNU Mailman.
8+#
9+# GNU Mailman is free software: you can redistribute it and/or modify it under
10+# the terms of the GNU General Public License as published by the Free
11+# Software Foundation, either version 3 of the License, or (at your option)
12+# any later version.
13+#
14+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
15+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17+# more details.
18+#
19+# You should have received a copy of the GNU General Public License along with
20+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
21+
22+"""3.0b3 -> 3.0b4 schema migrations.
23+
24+Type changes:
25+ * mailinglist.moderator_password: TEXT -> BYTEA
26+"""
27+
28+from __future__ import absolute_import, print_function, unicode_literals
29+
30+__metaclass__ = type
31+__all__ = [
32+ 'upgrade',
33+ ]
34+
35+
36+VERSION = '20131007000000'
37+
38+
39+
40
41+def upgrade(database, store, version, module_path):
42+ if database.TAG == 'sqlite':
43+ return
44+ store.execute("""
45+ ALTER TABLE mailinglist ALTER COLUMN moderator_password TYPE BYTEA
46+ USING convert_to(moderator_password, 'SQL_ASCII');
47+ """)
48+ # Record the migration in the version table.
49+ database.load_schema(store, version, None, module_path)
50+
51
52=== added file 'src/mailman/database/schema/mm_20131203000000.py'
53--- src/mailman/database/schema/mm_20131203000000.py 1970-01-01 00:00:00 +0000
54+++ src/mailman/database/schema/mm_20131203000000.py 2013-12-31 11:55:54 +0000
55@@ -0,0 +1,75 @@
56+# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
57+#
58+# This file is part of GNU Mailman.
59+#
60+# GNU Mailman is free software: you can redistribute it and/or modify it under
61+# the terms of the GNU General Public License as published by the Free
62+# Software Foundation, either version 3 of the License, or (at your option)
63+# any later version.
64+#
65+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
66+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
67+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
68+# more details.
69+#
70+# You should have received a copy of the GNU General Public License along with
71+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
72+
73+"""3.0b3 -> 3.0b4 schema migrations.
74+
75+Type changes:
76+ * bounceevent.list_id (NEW COLUMN)
77+ * per list archiver (NEW TABLE)
78+"""
79+
80+from __future__ import absolute_import, print_function, unicode_literals
81+
82+__metaclass__ = type
83+__all__ = [
84+ 'upgrade',
85+ ]
86+
87+
88+VERSION = '20131203000000'
89+
90+
91+
92
93+def upgrade(database, store, version, module_path):
94+ if database.TAG == 'sqlite':
95+ return
96+ store.execute("""
97+CREATE TABLE bounceevent_backup (
98+ id SERIAL NOT NULL,
99+ email TEXT,
100+ "timestamp" TIMESTAMP,
101+ message_id TEXT,
102+ context INTEGER,
103+ processed BOOLEAN,
104+ PRIMARY KEY (id)
105+ );
106+ """)
107+ store.execute("""
108+INSERT INTO bounceevent_backup SELECT
109+ id, email, "timestamp", message_id,
110+ context, processed
111+ FROM bounceevent;
112+ """)
113+ store.execute("""
114+ALTER TABLE bounceevent_backup ADD COLUMN list_id TEXT;
115+ """)
116+ store.execute("""
117+CREATE TABLE listarchiver (
118+ id SERIAL NOT NULL,
119+ mailing_list_id INTEGER NOT NULL,
120+ name TEXT NOT NULL,
121+ _is_enabled BOOLEAN,
122+ PRIMARY KEY (id)
123+ );
124+ """)
125+ store.execute("""
126+CREATE INDEX ix_listarchiver_mailing_list_id
127+ ON listarchiver(mailing_list_id);
128+ """)
129+ # Record the migration in the version table.
130+ database.load_schema(store, version, None, module_path)
131+