1 -- Create schema for ml_bulletins widget.
2 -- - by Richard W.M. Jones <rich@annexia.org>
4 -- This library is free software; you can redistribute it and/or
5 -- modify it under the terms of the GNU Library General Public
6 -- License as published by the Free Software Foundation; either
7 -- version 2 of the License, or (at your option) any later version.
9 -- This library is distributed in the hope that it will be useful,
10 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 -- Library General Public License for more details.
14 -- You should have received a copy of the GNU Library General Public
15 -- License along with this library; if not, write to the Free
16 -- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 -- $Id: ml_bulletins_create.sql,v 1.7 2002/11/15 20:46:03 rich Exp $
20 -- Depends: monolith_core, monolith_users, monolith_auth, monolith_resources
24 create table ml_bulletins_sections
27 constraint ml_bulletins_sections_resid_pk
29 references ml_resources (resid)
33 create table ml_bulletins_posters
35 sectionid int4 -- The section
36 references ml_bulletins_sections (resid)
38 userid int4 -- The user who can post in this section
39 references ml_users (userid)
43 create unique index ml_bulletins_posters_ui
44 on ml_bulletins_posters (sectionid, userid);
46 create table ml_bulletins
49 sectionid int4 -- Which section is this in?
50 constraint ml_bulletins_sectionid_nn
52 references ml_bulletins_sections (resid)
55 constraint ml_bulletins_authorid_nn
57 references ml_users (userid)
59 item text -- The text body of the item
60 constraint ml_bulletins_item_nn
62 item_type char(1) -- Type: plain, smart, HTML
63 constraint ml_bulletins_item_type_nn
65 constraint ml_bulletins_item_type_ck
66 check (item_type in ('p', 's', 'h')),
67 posted_date timestamp -- Date that this item was posted
68 default current_timestamp
69 constraint ml_bulletins_timestamp_nn
71 link text, -- Optional link
72 link_text text -- Optional text on the link
75 create index ml_bulletins_sectionid_i on ml_bulletins (sectionid);
77 -- Allow the web server to access this table.
78 grant select, insert, update, delete on ml_bulletins_sections to nobody;
79 grant select, insert, delete on ml_bulletins_posters to nobody;
80 grant select, insert, update, delete on ml_bulletins to nobody;
81 grant select, update on ml_bulletins_id_seq to nobody;