14 |
create table lists ( |
create table lists ( |
15 |
id serial, |
id serial, |
16 |
name text not null, |
name text not null, |
17 |
|
from_addr text not null default '', |
18 |
email text not null, |
email text not null, |
19 |
bounce_limit int not null default 3, |
bounce_limit int not null default 3, |
20 |
date timestamp not null default now(), |
date timestamp not null default now(), |
58 |
|
|
59 |
create table received ( |
create table received ( |
60 |
id serial, |
id serial, |
61 |
user_id int not null references users(id), |
user_id int references users(id), |
62 |
list_id int not null references lists(id), |
list_id int not null references lists(id), |
63 |
message_id int references messages(id), |
message_id int references messages(id), |
64 |
message text not null, |
message text not null, |
70 |
create index received_user_id_int on received(user_id); |
create index received_user_id_int on received(user_id); |
71 |
create index received_list_id_int on received(list_id); |
create index received_list_id_int on received(list_id); |
72 |
|
|
|
|
|
|
insert into users (email, name) values ('dpavlin@rot13.org', 'DbP'); |
|
|
insert into users (email, name) values ('dpavlin@gmail.com', 'DbP'); |
|
|
insert into users (email, name) values ('xxx_doesnt_exist_xxx@gmail.com', 'fake'); |
|
|
|
|
|
insert into lists (name, email) values ('Just me','my-alter-ego@rot13.org'); |
|
|
insert into lists (name, email) values ('All users','announce@example.com'); |
|
|
|
|
|
insert into user_list (user_id, list_id) select users.id,1 from users limit 1; |
|
|
insert into user_list (user_id, list_id) select users.id,2 from users; |
|