* Change whitespace

This commit is contained in:
Toshio Kuratomi 2008-02-15 14:54:27 -08:00
parent 38373eb1aa
commit d12782f736

View file

@ -2,8 +2,8 @@ create database fas2 encoding = 'UTF8';
\c fas2 \c fas2
create trusted procedural language plpgsql create trusted procedural language plpgsql
handler plpgsql_call_handler handler plpgsql_call_handler
validator plpgsql_validator; validator plpgsql_validator;
CREATE SEQUENCE cert_seq; CREATE SEQUENCE cert_seq;
SELECT setval('cert_seq', 1); SELECT setval('cert_seq', 1);
@ -63,56 +63,56 @@ CREATE TABLE groups (
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'))
@ -121,12 +121,12 @@ CREATE TABLE person_roles (
-- action r == remove -- action r == remove
-- action a == add -- action a == add
create table bugzilla_queue ( create table bugzilla_queue (
email text not null, email text not null,
group_id int references groups(id) not null, group_id int references groups(id) not null,
person_id int references people(id) not null, person_id int references people(id) not null,
action char(1) not null, action char(1) not null,
primary key (email, group_id), primary key (email, group_id),
check (action ~ '[ar]') check (action ~ '[ar]')
); );
create or replace function bugzilla_sync() returns trigger AS $bz_sync$ create or replace function bugzilla_sync() returns trigger AS $bz_sync$