--
--

-- Started on 2007-12-18 10:58:56 BRST




CREATE SCHEMA atos;


ALTER SCHEMA atos OWNER TO admin_atos;




--
-- TOC entry 1485 (class 1259 OID 5948214)
-- Dependencies: 2033 9
-- Name: atos_administrativos; Type: TABLE; Schema: atos; Owner: admin_atos; Tablespace: 
--

CREATE TABLE atos_administrativos (
    ato_in_categoria smallint NOT NULL,
    ato_in_ano smallint NOT NULL,
    ato_in_numero smallint NOT NULL,
    ato_st_area character varying(20) NOT NULL,
    ato_st_assunto character varying(200) NOT NULL,
    ato_st_texto text NOT NULL,
    ato_st_email text,
    ato_st_usu_inc character varying(200) NOT NULL,
    ato_dt_inc timestamp without time zone DEFAULT now()
);


ALTER TABLE atos.atos_administrativos OWNER TO admin_atos;

--
-- TOC entry 1697 (class 1259 OID 6007347)
-- Dependencies: 9
-- Name: categoria; Type: TABLE; Schema: atos; Owner: admin_atos; Tablespace: 
--

CREATE TABLE categoria (
    categoria_id serial NOT NULL,
    descricao character varying(50) NOT NULL
);


ALTER TABLE atos.categoria OWNER TO admin_atos;

--
-- TOC entry 2036 (class 2606 OID 5954059)
-- Dependencies: 1485 1485 1485 1485
-- Name: atos_administrativos_pkey; Type: CONSTRAINT; Schema: atos; Owner: admin_atos; Tablespace: 
--

ALTER TABLE ONLY atos_administrativos
    ADD CONSTRAINT atos_administrativos_pkey PRIMARY KEY (ato_in_categoria, ato_in_ano, ato_in_numero);


--
-- TOC entry 2038 (class 2606 OID 6007823)
-- Dependencies: 1697 1697
-- Name: categoria_pkey; Type: CONSTRAINT; Schema: atos; Owner: admin_atos; Tablespace: 
--

ALTER TABLE ONLY categoria
    ADD CONSTRAINT categoria_pkey PRIMARY KEY (categoria_id);


--
-- TOC entry 2039 (class 2606 OID 6007824)
-- Dependencies: 2037 1697 1485
-- Name: atos_administrativos_ato_in_categoria_fkey; Type: FK CONSTRAINT; Schema: atos; Owner: admin_atos
--

ALTER TABLE ONLY atos_administrativos
    ADD CONSTRAINT atos_administrativos_ato_in_categoria_fkey FOREIGN KEY (ato_in_categoria) REFERENCES categoria(categoria_id);


--
-- TOC entry 2041 (class 0 OID 0)
-- Dependencies: 9
-- Name: atos; Type: ACL; Schema: -; Owner: admin_atos
--

REVOKE ALL ON SCHEMA atos FROM PUBLIC;
REVOKE ALL ON SCHEMA atos FROM admin_atos;
GRANT ALL ON SCHEMA atos TO admin_atos;
GRANT ALL ON SCHEMA atos TO postgres;
GRANT ALL ON SCHEMA atos TO admin_workflow;


--
-- TOC entry 2042 (class 0 OID 0)
-- Dependencies: 1485
-- Name: atos_administrativos; Type: ACL; Schema: atos; Owner: admin_atos
--

REVOKE ALL ON TABLE atos_administrativos FROM PUBLIC;
REVOKE ALL ON TABLE atos_administrativos FROM admin_atos;
GRANT ALL ON TABLE atos_administrativos TO admin_atos;
GRANT ALL ON TABLE atos_administrativos TO postgres;
GRANT ALL ON TABLE atos_administrativos TO admin_workflow;


--
-- TOC entry 2043 (class 0 OID 0)
-- Dependencies: 1697
-- Name: categoria; Type: ACL; Schema: atos; Owner: admin_atos
--

REVOKE ALL ON TABLE categoria FROM PUBLIC;
REVOKE ALL ON TABLE categoria FROM admin_atos;
GRANT ALL ON TABLE categoria TO admin_atos;
GRANT ALL ON TABLE categoria TO postgres;
GRANT ALL ON TABLE categoria TO admin_workflow;


--
-- TOC entry 2044 (class 0 OID 0)
-- Dependencies: 1696
-- Name: categoria_categoria_id_seq; Type: ACL; Schema: atos; Owner: admin_atos
--

REVOKE ALL ON TABLE categoria_categoria_id_seq FROM PUBLIC;
REVOKE ALL ON TABLE categoria_categoria_id_seq FROM admin_atos;
GRANT ALL ON TABLE categoria_categoria_id_seq TO admin_atos;
GRANT ALL ON TABLE categoria_categoria_id_seq TO postgres;
GRANT ALL ON TABLE categoria_categoria_id_seq TO admin_workflow;


-- Completed on 2007-12-18 10:58:57 BRST

--
--

