summaryrefslogtreecommitdiff
path: root/src/mailman/database
diff options
context:
space:
mode:
authorBarry Warsaw2011-04-22 19:26:43 -0400
committerBarry Warsaw2011-04-22 19:26:43 -0400
commitb5b015ce524157cfef4b795e4b0c7ff17b4d0fe2 (patch)
tree260169450ab382cf59143f0fe8bae0fc0507452f /src/mailman/database
parent6959e6adcb582172aeec01ef6b6a75b9ba85017b (diff)
downloadmailman-b5b015ce524157cfef4b795e4b0c7ff17b4d0fe2.tar.gz
mailman-b5b015ce524157cfef4b795e4b0c7ff17b4d0fe2.tar.zst
mailman-b5b015ce524157cfef4b795e4b0c7ff17b4d0fe2.zip
Give IMembers a unique member id. We have to do this in order to give them a
path at the root of the resource tree (i.e. /members/X) and because when members can be subscribed by their IUser record (for preferred address), their canonical location cannot contain the address they are subscribed with. When their preferred address changes (without otherwise touching their membership), this address will change and that's not good for a canonical location. Other changes: * Added IMember.member_id attribute * Added ISubscriptionService.get_member() so member records can be retrieve by member id. * We can now get individual members by id via the REST API. * Extend the UniqueIDFactory so that it can take a 'context' (defaulting to None). The context is only used in the testing infrastructure so that separate files can be used for user ids and member ids. Otherwise, we'd have gaps in those sequences. * When *not* in testing mode, ensure that UIDs cannot be reused by keeping a table of all UIDs ever handed out. We *should* never get collisions, but this ensures it. * Clean up mailman.sql
Diffstat (limited to 'src/mailman/database')
-rw-r--r--src/mailman/database/mailman.sql17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mailman/database/mailman.sql b/src/mailman/database/mailman.sql
index 5af8656c2..deb266297 100644
--- a/src/mailman/database/mailman.sql
+++ b/src/mailman/database/mailman.sql
@@ -19,8 +19,7 @@ CREATE TABLE acceptablealias (
);
CREATE INDEX ix_acceptablealias_mailing_list_id
ON acceptablealias (mailing_list_id);
-CREATE INDEX ix_acceptablealias_alias
- ON acceptablealias ("alias");
+CREATE INDEX ix_acceptablealias_alias ON acceptablealias ("alias");
CREATE TABLE address (
id INTEGER NOT NULL,
@@ -197,6 +196,7 @@ CREATE TABLE mailinglist (
CREATE TABLE member (
id INTEGER NOT NULL,
+ _member_id TEXT,
role TEXT,
mailing_list TEXT,
moderation_action INTEGER,
@@ -211,6 +211,9 @@ CREATE TABLE member (
CONSTRAINT member_user_id_fk
FOREIGN KEY (user_id) REFERENCES user (id)
);
+CREATE INDEX ix_member__member_id ON member (_member_id);
+CREATE INDEX ix_member_address_id ON member (address_id);
+CREATE INDEX ix_member_preferences_id ON member (preferences_id);
CREATE TABLE message (
id INTEGER NOT NULL,
@@ -287,8 +290,6 @@ CREATE TABLE version (
CREATE INDEX ix__request_mailing_list_id ON _request (mailing_list_id);
CREATE INDEX ix_address_preferences_id ON address (preferences_id);
CREATE INDEX ix_address_user_id ON address (user_id);
-CREATE INDEX ix_member_address_id ON member (address_id);
-CREATE INDEX ix_member_preferences_id ON member (preferences_id);
CREATE INDEX ix_pendedkeyvalue_pended_id ON pendedkeyvalue (pended_id);
CREATE INDEX ix_user_preferences_id ON user (preferences_id);
@@ -298,3 +299,11 @@ CREATE TABLE ban (
mailing_list TEXT,
PRIMARY KEY (id)
);
+
+CREATE TABLE uid (
+ -- Keep track of all assigned unique ids to prevent re-use.
+ id INTEGER NOT NULL,
+ uid TEXT,
+ PRIMARY KEY (id)
+ );
+CREATE INDEX ix_uid_uid ON uid (uid); \ No newline at end of file