Try again to fix whitespace to match repo.

This commit is contained in:
Toshio Kuratomi 2008-02-15 14:59:06 -08:00
parent d12782f736
commit 627157d4ba

View file

@ -17,105 +17,105 @@ CREATE SEQUENCE group_seq;
SELECT setval('group_seq', 100000); SELECT setval('group_seq', 100000);
CREATE TABLE people ( CREATE TABLE people (
id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('person_seq'), id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('person_seq'),
username VARCHAR(32) UNIQUE NOT NULL, username VARCHAR(32) UNIQUE NOT NULL,
human_name TEXT NOT NULL, human_name TEXT NOT NULL,
-- TODO: Switch to this? -- TODO: Switch to this?
-- Also, app would be responsible for eliminating spaces and -- Also, app would be responsible for eliminating spaces and
-- uppercasing -- uppercasing
-- gpg_fingerprint varchar(40), -- gpg_fingerprint varchar(40),
gpg_keyid VARCHAR(17), gpg_keyid VARCHAR(17),
ssh_key TEXT, ssh_key TEXT,
password VARCHAR(127) NOT NULL, password VARCHAR(127) NOT NULL,
comments TEXT, comments TEXT,
postal_address TEXT, postal_address TEXT,
telephone TEXT, telephone TEXT,
facsimile TEXT, facsimile TEXT,
affiliation TEXT, affiliation TEXT,
certificate_serial integer default nextval('cert_seq'), certificate_serial integer default nextval('cert_seq'),
creation TIMESTAMP DEFAULT NOW(), creation TIMESTAMP DEFAULT NOW(),
approval_status TEXT DEFAULT 'unapproved', approval_status TEXT DEFAULT 'unapproved',
internal_comments TEXT, internal_comments TEXT,
ircnick TEXT, ircnick TEXT,
last_seen TIMESTAMP DEFAULT NOW(), last_seen TIMESTAMP DEFAULT NOW(),
status TEXT, status TEXT,
status_change TIMESTAMP DEFAULT NOW(), status_change TIMESTAMP DEFAULT NOW(),
check (status in ('active', 'vacation', 'inactive', 'pinged')), check (status in ('active', 'vacation', 'inactive', 'pinged')),
check (gpg_keyid ~ '^[0-9A-F]{17}$') check (gpg_keyid ~ '^[0-9A-F]{17}$')
); );
CREATE TABLE configs ( CREATE TABLE configs (
id SERIAL PRIMARY KEY, id SERIAL PRIMARY KEY,
person_id integer references people(id), person_id integer references people(id),
application text not null, application text not null,
attribute text not null, attribute text not null,
-- The value should be a simple value or a json string. -- The value should be a simple value or a json string.
-- Please create more config keys rather than abusing this with -- Please create more config keys rather than abusing this with
-- large datastructures. -- large datastructures.
value TEXT, value TEXT,
check (application in ('asterisk', 'moin', 'myfedora')) check (application in ('asterisk', 'moin', 'myfedora'))
); );
CREATE TABLE groups ( CREATE TABLE groups (
id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('group_seq'), id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('group_seq'),
name VARCHAR(32) UNIQUE NOT NULL, name VARCHAR(32) UNIQUE NOT NULL,
owner_id INTEGER NOT NULL REFERENCES people(id), owner_id INTEGER NOT NULL REFERENCES people(id),
group_type VARCHAR(16), group_type VARCHAR(16),
needs_sponsor INTEGER DEFAULT 0, needs_sponsor INTEGER DEFAULT 0,
user_can_remove INTEGER DEFAULT 1, user_can_remove INTEGER DEFAULT 1,
prerequisite_id INTEGER REFERENCES groups(id), prerequisite_id INTEGER REFERENCES groups(id),
joinmsg TEXT NULL DEFAULT '', joinmsg TEXT NULL DEFAULT '',
check (group_type in ('bugzilla','cvs', 'bzr', 'git', 'hg', 'mtn', check (group_type in ('bugzilla','cvs', 'bzr', 'git', 'hg', 'mtn',
'svn', 'shell', 'torrent', 'tracker', 'tracking', 'user')) 'svn', 'shell', 'torrent', 'tracker', 'tracking', 'user'))
); );
create table person_emails ( create table person_emails (
email text not null unique, email text not null unique,
person_id integer references people(id) not null, person_id integer references people(id) not null,
purpose text not null, purpose text not null,
primary key (person_id, email), primary key (person_id, email),
check (purpose in ('bugzilla', 'primary', 'cla')), check (purpose in ('bugzilla', 'primary', 'cla')),
check (email ~ '^[a-zA-Z0-9.]@[a-zA-Z0-9.][.][a-zA-Z]$'), check (email ~ '^[a-zA-Z0-9.]@[a-zA-Z0-9.][.][a-zA-Z]$'),
unique (person_id, purpose) unique (person_id, purpose)
); );
create table group_emails ( create table group_emails (
email text not null unique, email text not null unique,
group_id integer references groups(id) not null, group_id integer references groups(id) not null,
purpose text not null, purpose text not null,
primary key (group_id, email), primary key (group_id, email),
check (purpose in ('bugzilla', 'primary', 'cla')), check (purpose in ('bugzilla', 'primary', 'cla')),
unique (group_id, purpose) unique (group_id, purpose)
); );
CREATE TABLE group_roles ( CREATE TABLE group_roles (
member_id INTEGER NOT NULL REFERENCES groups(id), member_id INTEGER NOT NULL REFERENCES groups(id),
group_id INTEGER NOT NULL REFERENCES groups(id), group_id INTEGER NOT NULL REFERENCES groups(id),
role_type text NOT NULL, role_type text NOT NULL,
role_status text DEFAULT 'unapproved', role_status text DEFAULT 'unapproved',
internal_comments text, internal_comments text,
sponsor_id INTEGER REFERENCES people(id), sponsor_id INTEGER REFERENCES people(id),
creation TIMESTAMP DEFAULT NOW(), creation TIMESTAMP DEFAULT NOW(),
approval TIMESTAMP DEFAULT NOW(), approval TIMESTAMP DEFAULT NOW(),
UNIQUE (member_id, group_id), UNIQUE (member_id, group_id),
check (role_status in ('approved', 'unapproved')), check (role_status in ('approved', 'unapproved')),
check (role_type in ('user', 'administrator', 'sponsor')) check (role_type in ('user', 'administrator', 'sponsor'))
); );
CREATE TABLE person_roles ( CREATE TABLE person_roles (
person_id INTEGER NOT NULL REFERENCES people(id), person_id INTEGER NOT NULL REFERENCES people(id),
group_id INTEGER NOT NULL REFERENCES groups(id), group_id INTEGER NOT NULL REFERENCES groups(id),
-- role_type is something like "user", "administrator", etc. -- role_type is something like "user", "administrator", etc.
-- role_status tells us whether this has been approved or not -- role_status tells us whether this has been approved or not
role_type text NOT NULL, role_type text NOT NULL,
role_status text DEFAULT 'unapproved', role_status text DEFAULT 'unapproved',
internal_comments text, internal_comments text,
sponsor_id INTEGER REFERENCES people(id), sponsor_id INTEGER REFERENCES people(id),
creation TIMESTAMP DEFAULT NOW(), creation TIMESTAMP DEFAULT NOW(),
approval TIMESTAMP DEFAULT NOW(), approval TIMESTAMP DEFAULT NOW(),
UNIQUE (person_id, group_id), UNIQUE (person_id, group_id),
check (role_status in ('approved', 'unapproved')), check (role_status in ('approved', 'unapproved')),
check (role_type in ('user', 'administrator', 'sponsor')) check (role_type in ('user', 'administrator', 'sponsor'))
); );
-- action r == remove -- action r == remove