1 -- Create schema for monolith users.
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: monolith_users_create.sql,v 1.2 2002/11/15 20:46:05 rich Exp $
20 -- Depends: monolith_core
22 -- Monolith does not require that you use this table. You can modify
23 -- the schema in monolith_auth_create.sql to use your own users table
24 -- if you wish. However, many of the monolith standard widgets use
25 -- this table for accessing user information.
31 userid serial, -- Unique number for each user
32 email text -- Unique email address for each user
33 constraint ml_users_email_nn
35 username varchar(32) -- Displayed username (not necessarily unique)
36 constraint ml_users_username_nn
38 password varchar(32), -- Hashed password (not always required)
41 given_name text, -- Forename (in western locales)
42 family_name text, -- Surname (in western locales)
43 date_of_birth date, -- Date of birth
44 gender char(1) -- Gender
45 constraint ml_users_gender_ck
46 check (gender in ('m', 'f')),
48 -- Locale information.
49 langcode char(8), -- Language and modifiers
50 timezone int4 -- POSIX Timezone
51 references ml_timezones (id),
52 countrycode char(2) -- ISO country code
53 references ml_countries (code),
55 -- Accounting information.
56 signup_date date -- When the account was created
58 constraint ml_users_signup_date_nn
60 lastlogin_date date, -- When they last logged in
61 nr_logins int4 -- Number of times they have logged in
63 constraint ml_users_nr_logins_nn
65 bad_logins int4 -- Since they last logged in, how many bad
66 -- login attempts have been made
68 constraint ml_users_bad_logins_nn
72 create unique index ml_users_email_ui on ml_users (email);
74 -- Grant access to the webserver.
76 grant select, insert, update, delete on ml_users to nobody;
77 grant select, update on ml_users_userid_seq to nobody;