1 | create table users (
|
---|
2 | username varchar(128) primary key,
|
---|
3 | password text not null
|
---|
4 | );
|
---|
5 |
|
---|
6 | create table subscriptions (
|
---|
7 | id int primary key auto_increment,
|
---|
8 | name varchar(255),
|
---|
9 | email text,
|
---|
10 | rss bool not null default 0,
|
---|
11 | page bool not null default 0,
|
---|
12 | user varchar(128) not null references users.username,
|
---|
13 |
|
---|
14 | unique(user,name)
|
---|
15 | );
|
---|
16 |
|
---|
17 | create table predicates (
|
---|
18 | id int primary key auto_increment,
|
---|
19 | field varchar(128) not null,
|
---|
20 | value varchar(255),
|
---|
21 | type enum("org.greenstone.gsdlas.profiles.EqualsPredicate", "org.greenstone.gsdlas.profiles.SubstringMatchPredicate", "org.greenstone.gsdlas.profiles.QueryPredicate") not null,
|
---|
22 |
|
---|
23 | unique(field,type,value)
|
---|
24 | );
|
---|
25 |
|
---|
26 | create table subs_to_predicates (
|
---|
27 | subscription int not null references subscriptions.id,
|
---|
28 | predicate int not null references predicates.id,
|
---|
29 |
|
---|
30 | unique (subscription,predicate)
|
---|
31 | );
|
---|
32 |
|
---|
33 | create table events (
|
---|
34 | id int primary key auto_increment,
|
---|
35 | timestamp datetime not null,
|
---|
36 | content text not null
|
---|
37 | );
|
---|
38 |
|
---|
39 | create table events_to_subs (
|
---|
40 | event int not null references events.id,
|
---|
41 | subscription int not null references subscriptions.id,
|
---|
42 |
|
---|
43 | unique (event,subscription)
|
---|
44 | );
|
---|