-- CoP Base tables 
--
-- Copyright (C) 2004 Jeff Davis
-- @author Jeff Davis <davis@xarg.net>
-- @creation-date 7/20/2004
--
-- @cvs-id $Id: datamodel.sql,v 1.1 2005/01/25 23:33:43 jeffd Exp $
--
-- This is free software distributed under the terms of the GNU Public
-- License.  Full text of the license is available from the GNU Project:
-- http://www.fsf.org/copyleft/gpl.html

create table cop_requests ( 
        request_id      integer 
                        constraint cop_requests_pk primary key,
        user_id         integer 
                        constraint cop_requests_user_id_fk 
                        references users(user_id) 
                        not null,
        requested       timestamptz
                        default now(),
        from_ip         varchar(16),
        req_state       varchar(20)
                        constraint cop_requests_req_state_ck 
                        check (req_state in ('approved','denied','pending')),
        req_user_id     integer
                        constraint cop_requests_req_user_id_fk
                        references users(user_id),
        req_ip          varchar(16),
        req_action      timestamptz,
        title           varchar(200) not null,
        description     text not null,
        desc_format     varchar(100) not null,
        url_stub        varchar(200)
);
