diff options
| author | Aurélien Bompard | 2016-01-14 15:36:24 +0100 |
|---|---|---|
| committer | Aurélien Bompard | 2016-01-14 15:36:26 +0100 |
| commit | 6f0b236ea33ffe2899e813dc9bcbc58da0cbefee (patch) | |
| tree | c87d2bf6709d211e5d87dc2cd2e1f065b9958326 /src | |
| parent | a4ebbd164bdba4a7ede651dfcf802c300e8e9743 (diff) | |
| download | mailman-6f0b236ea33ffe2899e813dc9bcbc58da0cbefee.tar.gz mailman-6f0b236ea33ffe2899e813dc9bcbc58da0cbefee.tar.zst mailman-6f0b236ea33ffe2899e813dc9bcbc58da0cbefee.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py | 31 | ||||
| -rw-r--r-- | src/mailman/model/mailinglist.py | 6 |
2 files changed, 34 insertions, 3 deletions
diff --git a/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py b/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py new file mode 100644 index 000000000..c375fea1c --- /dev/null +++ b/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py @@ -0,0 +1,31 @@ +"""MailingList indexes + +Revision ID: 781a38e146bf +Revises: 70af5a4e5790 +Create Date: 2016-01-14 15:34:29.734429 + +""" + +# revision identifiers, used by Alembic. +revision = '781a38e146bf' +down_revision = '70af5a4e5790' + +from alembic import op + + +def upgrade(): + op.create_index( + op.f('ix_mailinglist_list_id'), 'mailinglist', ['list_id'], + unique=True) + op.create_index( + op.f('ix_mailinglist_list_name'), 'mailinglist', ['list_name'], + unique=False) + op.create_index( + op.f('ix_mailinglist_mail_host'), 'mailinglist', ['mail_host'], + unique=False) + + +def downgrade(): + op.drop_index(op.f('ix_mailinglist_mail_host'), table_name='mailinglist') + op.drop_index(op.f('ix_mailinglist_list_name'), table_name='mailinglist') + op.drop_index(op.f('ix_mailinglist_list_id'), table_name='mailinglist') diff --git a/src/mailman/model/mailinglist.py b/src/mailman/model/mailinglist.py index f8d1481a2..abc2c57f6 100644 --- a/src/mailman/model/mailinglist.py +++ b/src/mailman/model/mailinglist.py @@ -82,9 +82,9 @@ class MailingList(Model): # are currently missing. # List identity - list_name = Column(Unicode) - mail_host = Column(Unicode) - _list_id = Column('list_id', Unicode) + list_name = Column(Unicode, index=True) + mail_host = Column(Unicode, index=True) + _list_id = Column('list_id', Unicode, index=True, unique=True) allow_list_posts = Column(Boolean) include_rfc2369_headers = Column(Boolean) advertised = Column(Boolean) |
