1 -- Create schema for monolith chat widget.
2 -- Copyright (C) 2002 Richard W.M. Jones <rich@annexia.org>
3 -- This code is NOT REDISTRIBUTABLE. To use this widget you must purchase
4 -- a license at http://www.annexia.org/
6 -- $Id: ml_chat_create.sql,v 1.1 2003/02/22 12:49:21 rich Exp $
8 -- Depends: monolith_core, monolith_users, monolith_auth, monolith_resources
12 create table ml_chat_rooms
15 constraint ml_chat_rooms_resid_pk
17 references ml_resources (resid)
19 allow_anon boolean -- If true, allow anonymous postings
21 constraint ml_chat_rooms_allow_anon_nn
25 -- Postings are logged in this table. The chat software doesn't
26 -- actually pull postings out of this table when displaying the
27 -- page, because that would be too slow. This table is consulted
28 -- when the server starts up to populate the chat server's internal
31 create table ml_chat_log
33 id serial, -- Unique posting ID
34 resid int4 -- Which room does this belong to?
35 constraint ml_chat_log_resid_nn
37 references ml_chat_rooms (resid)
39 body text -- The posting
40 constraint ml_chat_log_body_nn
42 posted_date timestamp -- When posted
43 default current_timestamp
44 constraint ml_chat_log_posted_date_nn
46 author int4 -- Who posted (null == anonymous)
47 references ml_users (userid)
49 original_ip inet -- Originating IP address when posted
50 constraint ml_chat_log_original_ip_nn
54 create table ml_chat_fill_buffers
56 size int2 -- Number of bytes to send
57 constraint ml_chat_fill_buffers_size_nn
59 constraint ml_chat_fill_buffers_pk
63 create table ml_chat_userprefs
65 userid int4 -- The user ID.
66 constraint ml_chat_userprefs_userid_nn
68 references ml_users (userid)
70 fill_buffer int2 -- Size of the fill buffer.
72 constraint ml_chat_userprefs_fill_buffer_nn
74 references ml_chat_fill_buffers (size)
77 -- Populate the tables.
79 insert into ml_chat_fill_buffers (size) values (0);
80 insert into ml_chat_fill_buffers (size) values (1024);
81 insert into ml_chat_fill_buffers (size) values (2048);
82 insert into ml_chat_fill_buffers (size) values (4096);
83 insert into ml_chat_fill_buffers (size) values (8192);
84 insert into ml_chat_fill_buffers (size) values (16384);
86 -- Grant access to the webservers
88 grant select on ml_chat_rooms to nobody;
89 grant select, insert on ml_chat_log to nobody;
90 grant select, update on ml_chat_log_id_seq to nobody;
91 grant select on ml_chat_fill_buffers to nobody;
92 grant select, insert, update, delete on ml_chat_userprefs to nobody;