summaryrefslogtreecommitdiff
path: root/src/mailman/model/digests.py
diff options
context:
space:
mode:
authorBarry Warsaw2014-11-01 12:49:15 -0400
committerBarry Warsaw2014-11-01 12:49:15 -0400
commit8ab9c5111a05277e185b5e038bf12e13cd6df15e (patch)
tree9307b9f2fb65a90bc4d61a2c97478b582a96de87 /src/mailman/model/digests.py
parentb6bc505e45a2f1f4f99d7dd2cdd868d533270ee9 (diff)
parentfb38e482aa42edd4032a23e7c1f727066991fa62 (diff)
downloadmailman-8ab9c5111a05277e185b5e038bf12e13cd6df15e.tar.gz
mailman-8ab9c5111a05277e185b5e038bf12e13cd6df15e.tar.zst
mailman-8ab9c5111a05277e185b5e038bf12e13cd6df15e.zip
Database
-------- * The ORM layer, previously implemented with Storm, has been replaced by SQLAlchemy, thanks to the fantastic work by Abhilash Raj and Aurélien Bompard. Alembic is now used for all database schema migrations. * The new logger `mailman.database` logs any errors at the database layer. API --- * Several changes to the internal API: - `IListManager.mailing_lists` is guaranteed to be sorted in List-ID order. - `IDomains.mailing_lists` is guaranteed to be sorted in List-ID order. - Iteration over domains via the `IDomainManager` is guaranteed to be sorted by `IDomain.mail_host` order. - `ITemporaryDatabase` interface and all implementations are removed.
Diffstat (limited to 'src/mailman/model/digests.py')
-rw-r--r--src/mailman/model/digests.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/mailman/model/digests.py b/src/mailman/model/digests.py
index 5d9f3ddd1..7bfd512b6 100644
--- a/src/mailman/model/digests.py
+++ b/src/mailman/model/digests.py
@@ -25,7 +25,8 @@ __all__ = [
]
-from storm.locals import Int, Reference
+from sqlalchemy import Column, Integer, ForeignKey
+from sqlalchemy.orm import relationship
from zope.interface import implementer
from mailman.database.model import Model
@@ -39,15 +40,17 @@ from mailman.interfaces.member import DeliveryMode
class OneLastDigest(Model):
"""See `IOneLastDigest`."""
- id = Int(primary=True)
+ __tablename__ = 'onelastdigest'
- mailing_list_id = Int()
- mailing_list = Reference(mailing_list_id, 'MailingList.id')
+ id = Column(Integer, primary_key=True)
- address_id = Int()
- address = Reference(address_id, 'Address.id')
+ mailing_list_id = Column(Integer, ForeignKey('mailinglist.id'))
+ mailing_list = relationship('MailingList')
- delivery_mode = Enum(DeliveryMode)
+ address_id = Column(Integer, ForeignKey('address.id'))
+ address = relationship('Address')
+
+ delivery_mode = Column(Enum(DeliveryMode))
def __init__(self, mailing_list, address, delivery_mode):
self.mailing_list = mailing_list