diff options
| author | Barry Warsaw | 2007-11-04 18:10:21 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2007-11-04 18:10:21 -0500 |
| commit | 46f480dfaa6286ff8950af817de1c35910b37e16 (patch) | |
| tree | 194e8a3fb2150b7fa9ce5063a4b5b4acdf821365 /Mailman/database/model/message.py | |
| parent | 85473d738ce8ec53ac518819832e0babc3558cf2 (diff) | |
| download | mailman-46f480dfaa6286ff8950af817de1c35910b37e16.tar.gz mailman-46f480dfaa6286ff8950af817de1c35910b37e16.tar.zst mailman-46f480dfaa6286ff8950af817de1c35910b37e16.zip | |
Target Mailman onto the Storm <http://storm.canonical.com> Python ORM. This
enables a few interesting things:
1. It makes it easier to do our "pillars of storage" idea, where list data and
messages could live in one database, but user information live in a
separate database.
2. It reduces the number of moving parts. SQLAlchemy and Elixir can both go
away in favor of just one database layer.
3. No more Unicode/string mush hell. Somewhere along the way the upgrade to
SQLAlchemy 0.4 and Elixir 0.4 made the strings coming out the database
sometimes Unicode and sometimes 8-bit. This was totally unpredictable.
Storm asserts that if a property is declared Unicode, it comes in and goes
out as Unicode.
4. 'flush' is gone.
One cost of this is that Storm does not yet currently support schema
generation. So I cheat by dumping the trunk's SQLite schema and using that as
a starting place for the Storm-based schema. I hope that Storm will
eventually address this.
Other related changes include:
- SQLALCHEMY_ENGINE_URL is renamed to DEFAULT_DATABASE_URL. This may still
get changed.
Things I still want to fix:
- Ickyness with clearing the databases.
- Really implement multiple stores with better management of the Store
instances.
- Fix all the circular import nasties.
Diffstat (limited to 'Mailman/database/model/message.py')
| -rw-r--r-- | Mailman/database/model/message.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Mailman/database/model/message.py b/Mailman/database/model/message.py index eb4b4616d..7a6d7371a 100644 --- a/Mailman/database/model/message.py +++ b/Mailman/database/model/message.py @@ -15,18 +15,21 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -from elixir import * +from storm.locals import * from zope.interface import implements +from Mailman.database import Model from Mailman.interfaces import IMessage -class Message(Entity): +class Message(Model): """A message in the message store.""" implements(IMessage) - hash = Field(Unicode) - path = Field(Unicode) - message_id = Field(Unicode) + id = Int(primary=True) + hash = Unicode() + path = Unicode() + # This is a Messge-ID field representation, not a database row id. + message_id = Unicode() |
