summaryrefslogtreecommitdiff
path: root/src/mailman/database
diff options
context:
space:
mode:
authorBarry Warsaw2014-04-14 12:14:13 -0400
committerBarry Warsaw2014-04-14 12:14:13 -0400
commit403cbf23c07839b60c85c0bc791b6437f05c8a85 (patch)
treeb36d0ecab20e01f23bcf66ab2b27633aaf3e99c3 /src/mailman/database
parentff6df86000da8fcb055101c5cede36b27cb0480a (diff)
parent3a9725b91ef822122a70170333d71b58e1788a78 (diff)
downloadmailman-403cbf23c07839b60c85c0bc791b6437f05c8a85.tar.gz
mailman-403cbf23c07839b60c85c0bc791b6437f05c8a85.tar.zst
mailman-403cbf23c07839b60c85c0bc791b6437f05c8a85.zip
Trunk merge
Diffstat (limited to 'src/mailman/database')
-rw-r--r--src/mailman/database/base.py2
-rw-r--r--src/mailman/database/factory.py2
-rw-r--r--src/mailman/database/model.py2
-rw-r--r--src/mailman/database/postgresql.py2
-rw-r--r--src/mailman/database/schema/helpers.py2
-rw-r--r--src/mailman/database/schema/mm_00000000000000_base.py2
-rw-r--r--src/mailman/database/schema/mm_20120407000000.py2
-rw-r--r--src/mailman/database/schema/mm_20121015000000.py2
-rw-r--r--src/mailman/database/schema/mm_20130406000000.py2
-rw-r--r--src/mailman/database/schema/sqlite_20130406000000_01.sql20
-rw-r--r--src/mailman/database/sqlite.py2
-rw-r--r--src/mailman/database/tests/test_migrations.py29
-rw-r--r--src/mailman/database/transaction.py2
-rw-r--r--src/mailman/database/types.py2
14 files changed, 58 insertions, 15 deletions
diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py
index 0b23c8adc..cbf88a4ff 100644
--- a/src/mailman/database/base.py
+++ b/src/mailman/database/base.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/factory.py b/src/mailman/database/factory.py
index f02354c11..db453ea41 100644
--- a/src/mailman/database/factory.py
+++ b/src/mailman/database/factory.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/model.py b/src/mailman/database/model.py
index 435e910fd..ba2d39213 100644
--- a/src/mailman/database/model.py
+++ b/src/mailman/database/model.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py
index 8586df068..48c68a937 100644
--- a/src/mailman/database/postgresql.py
+++ b/src/mailman/database/postgresql.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/helpers.py b/src/mailman/database/schema/helpers.py
index c8638a12a..827e6cc96 100644
--- a/src/mailman/database/schema/helpers.py
+++ b/src/mailman/database/schema/helpers.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2013-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/mm_00000000000000_base.py b/src/mailman/database/schema/mm_00000000000000_base.py
index 41e85d057..ad085427f 100644
--- a/src/mailman/database/schema/mm_00000000000000_base.py
+++ b/src/mailman/database/schema/mm_00000000000000_base.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/mm_20120407000000.py b/src/mailman/database/schema/mm_20120407000000.py
index c1045fa91..1d798ea96 100644
--- a/src/mailman/database/schema/mm_20120407000000.py
+++ b/src/mailman/database/schema/mm_20120407000000.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/mm_20121015000000.py b/src/mailman/database/schema/mm_20121015000000.py
index da3671998..84510ff57 100644
--- a/src/mailman/database/schema/mm_20121015000000.py
+++ b/src/mailman/database/schema/mm_20121015000000.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/mm_20130406000000.py b/src/mailman/database/schema/mm_20130406000000.py
index 11ba70869..8d38dbab0 100644
--- a/src/mailman/database/schema/mm_20130406000000.py
+++ b/src/mailman/database/schema/mm_20130406000000.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2013-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/schema/sqlite_20130406000000_01.sql b/src/mailman/database/schema/sqlite_20130406000000_01.sql
index 9bdc2aae0..fe30ed247 100644
--- a/src/mailman/database/schema/sqlite_20130406000000_01.sql
+++ b/src/mailman/database/schema/sqlite_20130406000000_01.sql
@@ -6,12 +6,17 @@
-- For SQLite3 migration strategy, see
-- http://sqlite.org/faq.html#q11
--- REMOVALS from the bounceevent table:
+-- ADD listarchiver table.
+
+-- REMOVALs from the bounceevent table:
-- REM list_name
--- ADDS to the ban bounceevent table:
+-- ADDs to the bounceevent table:
-- ADD list_id
+-- ADDs to the mailinglist table:
+-- ADD archiver_id
+
CREATE TABLE bounceevent_backup (
id INTEGER NOT NULL,
email TEXT,
@@ -28,3 +33,14 @@ INSERT INTO bounceevent_backup SELECT
FROM bounceevent;
ALTER TABLE bounceevent_backup ADD COLUMN list_id TEXT;
+
+CREATE TABLE listarchiver (
+ id INTEGER NOT NULL,
+ mailing_list_id INTEGER NOT NULL,
+ name TEXT NOT NULL,
+ _is_enabled BOOLEAN,
+ PRIMARY KEY (id)
+ );
+
+CREATE INDEX ix_listarchiver_mailing_list_id
+ ON listarchiver(mailing_list_id);
diff --git a/src/mailman/database/sqlite.py b/src/mailman/database/sqlite.py
index 8fe170cda..15629615f 100644
--- a/src/mailman/database/sqlite.py
+++ b/src/mailman/database/sqlite.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2011-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index d983f9891..9619b80a4 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2012-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -36,6 +36,7 @@ import unittest
from datetime import datetime
from operator import attrgetter
from pkg_resources import resource_string
+from sqlite3 import OperationalError
from storm.exceptions import DatabaseError
from zope.component import getUtility
@@ -65,6 +66,23 @@ class MigrationTestBase(unittest.TestCase):
def tearDown(self):
self._database._cleanup()
+ def _table_missing_present(self, migrations, missing, present):
+ """The appropriate migrations leave some tables missing and present.
+
+ :param migrations: Sequence of migrations to load.
+ :param missing: Tables which should be missing.
+ :param present: Tables which should be present.
+ """
+ for migration in migrations:
+ self._database.load_migrations(migration)
+ self._database.store.commit()
+ for table in missing:
+ self.assertRaises(OperationalError,
+ self._database.store.execute,
+ 'select * from {};'.format(table))
+ for table in present:
+ self._database.store.execute('select * from {};'.format(table))
+
def _missing_present(self, table, migrations, missing, present):
"""The appropriate migrations leave columns missing and present.
@@ -450,6 +468,15 @@ class TestMigration20130406Schema(MigrationTestBase):
('list_name',),
('list_id',))
+ def test_pre_listarchiver_table(self):
+ self._table_missing_present(['20130405999999'], ('listarchiver',), ())
+
+ def test_post_listarchiver_table(self):
+ self._table_missing_present(['20130405999999',
+ '20130406000000'],
+ (),
+ ('listarchiver',))
+
class TestMigration20130406MigratedData(MigrationTestBase):
diff --git a/src/mailman/database/transaction.py b/src/mailman/database/transaction.py
index dc2411915..3e156cfb8 100644
--- a/src/mailman/database/transaction.py
+++ b/src/mailman/database/transaction.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/src/mailman/database/types.py b/src/mailman/database/types.py
index 86d504ca3..eb3a4d357 100644
--- a/src/mailman/database/types.py
+++ b/src/mailman/database/types.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#