--- trunk/schema.sql	2005/05/17 15:05:57	35
+++ trunk/schema.sql	2005/05/17 17:49:14	36
@@ -48,19 +48,27 @@
 create table sent (
 	message_id int not null references messages(id) on update cascade on delete cascade,
 	user_id	int not null references users(id) on update cascade on delete cascade,
+	hash	text not null,
 	date	timestamp not null default now(),
 	primary key(message_id, user_id)
 );
 
+create unique index sent_hash_ind on sent(hash);
+
 create table received (
 	id serial,
-	user_id	int not null references users(id) on update cascade on delete cascade,
+	user_id	int not null references users(id),
+	list_id	int not null references lists(id),
+	message_id int references messages(id),
 	message	text not null,
 	bounced	boolean not null default false,
 	date	timestamp not null default now(),
 	primary key (id)
 );
 
+create index received_user_id_int on received(user_id);
+create index received_list_id_int on received(list_id);
+
 
 insert into users (email, full_name) values ('dpavlin@rot13.org', 'DbP');
 insert into users (email, full_name) values ('dpavlin@gmail.com', 'DbP');
