Overview
As all of you may know many open source web applications claim support (or at least experimental) support with various databases. the ADODb for PHP project is something many packages use to accomplish this. However I find that at least in the case of eGroupWare and Mantis this support is far from complete. I will be profiling what I did here to fix these issues.
Schemas
As many may know if you have more then one application using your database as its how the database can feel crowded. This is certainly the case with Mantis and eGroupWare. I have solved this issue with the use of schemas. I could have decided to modify the software to support schemas but that would have taken weeks instead I simply created a schema, created a user and added the schema as the fist (default) schema in the users search path. The following code will outline that process:
-- Create the Mantis Schema
CREATE SCHEMA mantisbt
AUTHORIZATION "user_Mantis";
GRANT ALL ON SCHEMA mantisbt TO "user_Mantis";
GRANT ALL ON SCHEMA mantisbt TO public;
-- Create a User for Mantis
CREATE ROLE "user_Mantis" LOGIN
ENCRYPTED PASSWORD 'md5deadbeefdeadbeefdeadbeefdeadbeef'
NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;
-- Modify the Mantis user to use its schema as default
-- This is completely transparent to the app
ALTER ROLE "user_Mantis" SET search_path=mantisbt, public;
Mantis
Disclaimer: Due to business requirements I am using a prerelease version of this software. This is labeled as version 1.1.0a3. Though I have found it to work perfectly, it is still prerelease and there is also nothing stating that this trick will work on any other version of this software.
I managed to get through the normal Mantis installation procedure up to and until I had to create a new user. It failed with a warning about type casting between integers and booleans. Mantis, like many web applications used boolean fields in their database and ‘1′ and ‘0′ to toggle true and false. While this is fine in the less type-strict MySQL where a boolean is represented as a TINYINT(1) this does not work with PostgreSQL. In PostgreSQL a boolean is a type that requires ‘True’ and ‘False’ to toggle without an explicit cast. Since I could not go through all of the Mantis code replacing 0’s and 1’s with True and False being careful not to do so on an integer field, I decided to modify the database schema to use only integers, as you can see below.
--
-- PostgreSQL database dump
--
-- Started on 2007-07-07 09:59:57
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
--
-- TOC entry 6 (class 2615 OID 18072)
-- Name: mantis; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA mantisbt;
SET search_path = mantisbt, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 1675 (class 1259 OID 18074)
-- Dependencies: 2054 2055 2056 2057 2058 2059 2060 2061 2062 6
-- Name: mantis_bug_file_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_file_table (
id integer NOT NULL,
bug_id integer DEFAULT 0 NOT NULL,
title character varying(250) DEFAULT ''::character varying NOT NULL,
description character varying(250) DEFAULT ''::character varying NOT NULL,
diskfile character varying(250) DEFAULT ''::character varying NOT NULL,
filename character varying(250) DEFAULT ''::character varying NOT NULL,
folder character varying(250) DEFAULT ''::character varying NOT NULL,
filesize integer DEFAULT 0 NOT NULL,
file_type character varying(250) DEFAULT ''::character varying NOT NULL,
date_added timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
"content" bytea NOT NULL
);
--
-- TOC entry 1676 (class 1259 OID 18088)
-- Dependencies: 6 1675
-- Name: mantis_bug_file_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bug_file_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2337 (class 0 OID 0)
-- Dependencies: 1676
-- Name: mantis_bug_file_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bug_file_table_id_seq OWNED BY mantis_bug_file_table.id;
--
-- TOC entry 1677 (class 1259 OID 18090)
-- Dependencies: 2065 2066 2067 2068 2069 2070 2071 6
-- Name: mantis_bug_history_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_history_table (
id integer NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
bug_id integer DEFAULT 0 NOT NULL,
date_modified timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
field_name character varying(32) DEFAULT ''::character varying NOT NULL,
old_value character varying(128) DEFAULT ''::character varying NOT NULL,
new_value character varying(128) DEFAULT ''::character varying NOT NULL,
"type" smallint DEFAULT 0 NOT NULL
);
--
-- TOC entry 1678 (class 1259 OID 18099)
-- Dependencies: 6 1677
-- Name: mantis_bug_history_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bug_history_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2338 (class 0 OID 0)
-- Dependencies: 1678
-- Name: mantis_bug_history_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bug_history_table_id_seq OWNED BY mantis_bug_history_table.id;
--
-- TOC entry 1679 (class 1259 OID 18101)
-- Dependencies: 2072 2073 6
-- Name: mantis_bug_monitor_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_monitor_table (
user_id integer DEFAULT 0 NOT NULL,
bug_id integer DEFAULT 0 NOT NULL
);
--
-- TOC entry 1680 (class 1259 OID 18105)
-- Dependencies: 2075 2076 2077 6
-- Name: mantis_bug_relationship_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_relationship_table (
id integer NOT NULL,
source_bug_id integer DEFAULT 0 NOT NULL,
destination_bug_id integer DEFAULT 0 NOT NULL,
relationship_type smallint DEFAULT 0 NOT NULL
);
--
-- TOC entry 1681 (class 1259 OID 18110)
-- Dependencies: 1680 6
-- Name: mantis_bug_relationship_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bug_relationship_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2339 (class 0 OID 0)
-- Dependencies: 1681
-- Name: mantis_bug_relationship_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bug_relationship_table_id_seq OWNED BY mantis_bug_relationship_table.id;
--
-- TOC entry 1682 (class 1259 OID 18112)
-- Dependencies: 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 6
-- Name: mantis_bug_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_table (
id integer NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
reporter_id integer DEFAULT 0 NOT NULL,
handler_id integer DEFAULT 0 NOT NULL,
duplicate_id integer DEFAULT 0 NOT NULL,
priority smallint DEFAULT 30 NOT NULL,
severity smallint DEFAULT 50 NOT NULL,
reproducibility smallint DEFAULT 10 NOT NULL,
status smallint DEFAULT 10 NOT NULL,
resolution smallint DEFAULT 10 NOT NULL,
projection smallint DEFAULT 10 NOT NULL,
category character varying(64) DEFAULT ''::character varying NOT NULL,
date_submitted timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
last_updated timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
eta smallint DEFAULT 10 NOT NULL,
bug_text_id integer DEFAULT 0 NOT NULL,
os character varying(32) DEFAULT ''::character varying NOT NULL,
os_build character varying(32) DEFAULT ''::character varying NOT NULL,
platform character varying(32) DEFAULT ''::character varying NOT NULL,
"version" character varying(64) DEFAULT ''::character varying NOT NULL,
fixed_in_version character varying(64) DEFAULT ''::character varying NOT NULL,
build character varying(32) DEFAULT ''::character varying NOT NULL,
profile_id integer DEFAULT 0 NOT NULL,
view_state smallint DEFAULT 10 NOT NULL,
summary character varying(128) DEFAULT ''::character varying NOT NULL,
sponsorship_total integer DEFAULT 0 NOT NULL,
sticky integer DEFAULT 0 NOT NULL,
target_version character varying(64) DEFAULT ''::character varying NOT NULL
);
--
-- TOC entry 1683 (class 1259 OID 18144)
-- Dependencies: 6 1682
-- Name: mantis_bug_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bug_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2340 (class 0 OID 0)
-- Dependencies: 1683
-- Name: mantis_bug_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bug_table_id_seq OWNED BY mantis_bug_table.id;
--
-- TOC entry 1684 (class 1259 OID 18146)
-- Dependencies: 6
-- Name: mantis_bug_text_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bug_text_table (
id integer NOT NULL,
description text NOT NULL,
steps_to_reproduce text NOT NULL,
additional_information text NOT NULL
);
--
-- TOC entry 1685 (class 1259 OID 18151)
-- Dependencies: 1684 6
-- Name: mantis_bug_text_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bug_text_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2341 (class 0 OID 0)
-- Dependencies: 1685
-- Name: mantis_bug_text_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bug_text_table_id_seq OWNED BY mantis_bug_text_table.id;
--
-- TOC entry 1686 (class 1259 OID 18153)
-- Dependencies: 2107 2108 2109 2110 2111 2112 2113 2114 2115 6
-- Name: mantis_bugnote_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bugnote_table (
id integer NOT NULL,
bug_id integer DEFAULT 0 NOT NULL,
reporter_id integer DEFAULT 0 NOT NULL,
bugnote_text_id integer DEFAULT 0 NOT NULL,
view_state smallint DEFAULT 10 NOT NULL,
date_submitted timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
last_modified timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
note_type integer DEFAULT 0,
note_attr character varying(250) DEFAULT ''::character varying,
time_tracking integer DEFAULT 0 NOT NULL
);
--
-- TOC entry 1687 (class 1259 OID 18164)
-- Dependencies: 6 1686
-- Name: mantis_bugnote_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bugnote_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2342 (class 0 OID 0)
-- Dependencies: 1687
-- Name: mantis_bugnote_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bugnote_table_id_seq OWNED BY mantis_bugnote_table.id;
--
-- TOC entry 1688 (class 1259 OID 18166)
-- Dependencies: 6
-- Name: mantis_bugnote_text_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_bugnote_text_table (
id integer NOT NULL,
note text NOT NULL
);
--
-- TOC entry 1689 (class 1259 OID 18171)
-- Dependencies: 6 1688
-- Name: mantis_bugnote_text_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_bugnote_text_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2343 (class 0 OID 0)
-- Dependencies: 1689
-- Name: mantis_bugnote_text_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_bugnote_text_table_id_seq OWNED BY mantis_bugnote_text_table.id;
--
-- TOC entry 1690 (class 1259 OID 18173)
-- Dependencies: 2118 2119 2120 2121 6
-- Name: mantis_config_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_config_table (
config_id character varying(64) NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
access_reqd integer DEFAULT 0,
"type" integer DEFAULT 90,
"value" text NOT NULL
);
--
-- TOC entry 1691 (class 1259 OID 18182)
-- Dependencies: 2122 2123 2124 6
-- Name: mantis_custom_field_project_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_custom_field_project_table (
field_id integer DEFAULT 0 NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
"sequence" smallint DEFAULT 0 NOT NULL
);
--
-- TOC entry 1692 (class 1259 OID 18187)
-- Dependencies: 2125 2126 2127 6
-- Name: mantis_custom_field_string_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_custom_field_string_table (
field_id integer DEFAULT 0 NOT NULL,
bug_id integer DEFAULT 0 NOT NULL,
"value" character varying(255) DEFAULT ''::character varying NOT NULL
);
--
-- TOC entry 1693 (class 1259 OID 18192)
-- Dependencies: 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 6
-- Name: mantis_custom_field_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_custom_field_table (
id integer NOT NULL,
"name" character varying(64) DEFAULT ''::character varying NOT NULL,
"type" smallint DEFAULT 0 NOT NULL,
possible_values character varying(255) DEFAULT ''::character varying NOT NULL,
default_value character varying(255) DEFAULT ''::character varying NOT NULL,
valid_regexp character varying(255) DEFAULT ''::character varying NOT NULL,
access_level_r smallint DEFAULT 0 NOT NULL,
access_level_rw smallint DEFAULT 0 NOT NULL,
length_min integer DEFAULT 0 NOT NULL,
length_max integer DEFAULT 0 NOT NULL,
advanced integer DEFAULT 0 NOT NULL,
require_report integer DEFAULT 0 NOT NULL,
require_update integer DEFAULT 0 NOT NULL,
display_report integer DEFAULT 1 NOT NULL,
display_update integer DEFAULT 1 NOT NULL,
require_resolved integer DEFAULT 0 NOT NULL,
display_resolved integer DEFAULT 0 NOT NULL,
display_closed integer DEFAULT 0 NOT NULL,
require_closed integer DEFAULT 0 NOT NULL
);
--
-- TOC entry 1694 (class 1259 OID 18215)
-- Dependencies: 1693 6
-- Name: mantis_custom_field_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_custom_field_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2344 (class 0 OID 0)
-- Dependencies: 1694
-- Name: mantis_custom_field_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_custom_field_table_id_seq OWNED BY mantis_custom_field_table.id;
--
-- TOC entry 1695 (class 1259 OID 18217)
-- Dependencies: 2148 2149 2150 6
-- Name: mantis_email_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_email_table (
email_id integer NOT NULL,
email character varying(64) DEFAULT ''::character varying NOT NULL,
subject character varying(250) DEFAULT ''::character varying NOT NULL,
submitted timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
metadata text NOT NULL,
body text NOT NULL
);
--
-- TOC entry 1696 (class 1259 OID 18225)
-- Dependencies: 1695 6
-- Name: mantis_email_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_email_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2345 (class 0 OID 0)
-- Dependencies: 1696
-- Name: mantis_email_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_email_table_id_seq OWNED BY mantis_email_table.email_id;
--
-- TOC entry 1697 (class 1259 OID 18227)
-- Dependencies: 2152 2153 2154 6
-- Name: mantis_filters_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_filters_table (
id integer NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
is_public boolean,
"name" character varying(64) DEFAULT ''::character varying NOT NULL,
filter_string text NOT NULL
);
--
-- TOC entry 1698 (class 1259 OID 18235)
-- Dependencies: 6 1697
-- Name: mantis_filters_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_filters_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2346 (class 0 OID 0)
-- Dependencies: 1698
-- Name: mantis_filters_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_filters_table_id_seq OWNED BY mantis_filters_table.id;
--
-- TOC entry 1699 (class 1259 OID 18237)
-- Dependencies: 2156 2157 2158 2159 2160 2161 2162 6
-- Name: mantis_news_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_news_table (
id integer NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
poster_id integer DEFAULT 0 NOT NULL,
date_posted timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
last_modified timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
view_state smallint DEFAULT 10 NOT NULL,
announcement integer DEFAULT 0 NOT NULL,
headline character varying(64) DEFAULT ''::character varying NOT NULL,
body text NOT NULL
);
--
-- TOC entry 1700 (class 1259 OID 18249)
-- Dependencies: 6 1699
-- Name: mantis_news_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_news_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2347 (class 0 OID 0)
-- Dependencies: 1700
-- Name: mantis_news_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_news_table_id_seq OWNED BY mantis_news_table.id;
--
-- TOC entry 1701 (class 1259 OID 18251)
-- Dependencies: 2163 2164 2165 6
-- Name: mantis_project_category_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_category_table (
project_id integer DEFAULT 0 NOT NULL,
category character varying(64) DEFAULT ''::character varying NOT NULL,
user_id integer DEFAULT 0 NOT NULL
);
--
-- TOC entry 1702 (class 1259 OID 18256)
-- Dependencies: 2166 2167 2168 2169 2170 2171 2172 2173 2174 6
-- Name: mantis_project_file_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_file_table (
id integer NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
title character varying(250) DEFAULT ''::character varying NOT NULL,
description character varying(250) DEFAULT ''::character varying NOT NULL,
diskfile character varying(250) DEFAULT ''::character varying NOT NULL,
filename character varying(250) DEFAULT ''::character varying NOT NULL,
folder character varying(250) DEFAULT ''::character varying NOT NULL,
filesize integer DEFAULT 0 NOT NULL,
file_type character varying(250) DEFAULT ''::character varying NOT NULL,
date_added timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
"content" bytea NOT NULL
);
--
-- TOC entry 1703 (class 1259 OID 18270)
-- Dependencies: 1702 6
-- Name: mantis_project_file_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_project_file_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2348 (class 0 OID 0)
-- Dependencies: 1703
-- Name: mantis_project_file_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_project_file_table_id_seq OWNED BY mantis_project_file_table.id;
--
-- TOC entry 1704 (class 1259 OID 18272)
-- Dependencies: 6
-- Name: mantis_project_hierarchy_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_hierarchy_table (
child_id integer NOT NULL,
parent_id integer NOT NULL
);
--
-- TOC entry 1705 (class 1259 OID 18274)
-- Dependencies: 2177 2178 2179 2180 2181 2182 6
-- Name: mantis_project_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_table (
id integer NOT NULL,
"name" character varying(128) DEFAULT ''::character varying NOT NULL,
status smallint DEFAULT 10 NOT NULL,
enabled integer DEFAULT 1 NOT NULL,
view_state smallint DEFAULT 10 NOT NULL,
access_min smallint DEFAULT 10 NOT NULL,
file_path character varying(250) DEFAULT ''::character varying NOT NULL,
description text NOT NULL
);
--
-- TOC entry 1706 (class 1259 OID 18285)
-- Dependencies: 1705 6
-- Name: mantis_project_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_project_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2349 (class 0 OID 0)
-- Dependencies: 1706
-- Name: mantis_project_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_project_table_id_seq OWNED BY mantis_project_table.id;
--
-- TOC entry 1707 (class 1259 OID 18287)
-- Dependencies: 2183 2184 2185 6
-- Name: mantis_project_user_list_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_user_list_table (
project_id integer DEFAULT 0 NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
access_level smallint DEFAULT 10 NOT NULL
);
--
-- TOC entry 1708 (class 1259 OID 18292)
-- Dependencies: 2187 2188 2189 2190 6
-- Name: mantis_project_version_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_project_version_table (
id integer NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
"version" character varying(64) DEFAULT ''::character varying NOT NULL,
date_order timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
description text NOT NULL,
released integer DEFAULT 1 NOT NULL
);
--
-- TOC entry 1709 (class 1259 OID 18301)
-- Dependencies: 6 1708
-- Name: mantis_project_version_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_project_version_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2350 (class 0 OID 0)
-- Dependencies: 1709
-- Name: mantis_project_version_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_project_version_table_id_seq OWNED BY mantis_project_version_table.id;
--
-- TOC entry 1710 (class 1259 OID 18303)
-- Dependencies: 2191 2192 2193 2194 2195 2196 2197 2198 6
-- Name: mantis_sponsorship_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_sponsorship_table (
id integer NOT NULL,
bug_id integer DEFAULT 0 NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
amount integer DEFAULT 0 NOT NULL,
logo character varying(128) DEFAULT ''::character varying NOT NULL,
url character varying(128) DEFAULT ''::character varying NOT NULL,
paid integer DEFAULT 0 NOT NULL,
date_submitted timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
last_updated timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL
);
--
-- TOC entry 1711 (class 1259 OID 18313)
-- Dependencies: 6 1710
-- Name: mantis_sponsorship_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_sponsorship_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2351 (class 0 OID 0)
-- Dependencies: 1711
-- Name: mantis_sponsorship_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_sponsorship_table_id_seq OWNED BY mantis_sponsorship_table.id;
--
-- TOC entry 1712 (class 1259 OID 18315)
-- Dependencies: 6
-- Name: mantis_tokens_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_tokens_table (
id integer NOT NULL,
"owner" integer NOT NULL,
"type" integer NOT NULL,
"timestamp" timestamp without time zone NOT NULL,
expiry timestamp without time zone,
"value" text NOT NULL
);
--
-- TOC entry 1713 (class 1259 OID 18320)
-- Dependencies: 1712 6
-- Name: mantis_tokens_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_tokens_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2352 (class 0 OID 0)
-- Dependencies: 1713
-- Name: mantis_tokens_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_tokens_table_id_seq OWNED BY mantis_tokens_table.id;
--
-- TOC entry 1714 (class 1259 OID 18322)
-- Dependencies: 6
-- Name: mantis_upgrade_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_upgrade_table (
upgrade_id character(20) NOT NULL,
description character(255) NOT NULL
);
--
-- TOC entry 1715 (class 1259 OID 18324)
-- Dependencies: 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 6
-- Name: mantis_user_pref_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_user_pref_table (
id integer NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
project_id integer DEFAULT 0 NOT NULL,
default_profile integer DEFAULT 0 NOT NULL,
default_project integer DEFAULT 0 NOT NULL,
advanced_report integer DEFAULT 0 NOT NULL,
advanced_view integer DEFAULT 0 NOT NULL,
advanced_update integer DEFAULT 0 NOT NULL,
refresh_delay integer DEFAULT 0 NOT NULL,
redirect_delay integer DEFAULT 0 NOT NULL,
bugnote_order character varying(4) DEFAULT 'ASC'::character varying NOT NULL,
email_on_new integer DEFAULT 0 NOT NULL,
email_on_assigned integer DEFAULT 0 NOT NULL,
email_on_feedback integer DEFAULT 0 NOT NULL,
email_on_resolved integer DEFAULT 0 NOT NULL,
email_on_closed integer DEFAULT 0 NOT NULL,
email_on_reopened integer DEFAULT 0 NOT NULL,
email_on_bugnote integer DEFAULT 0 NOT NULL,
email_on_status integer DEFAULT 0 NOT NULL,
email_on_priority integer DEFAULT 0 NOT NULL,
email_on_priority_min_severity smallint DEFAULT 10 NOT NULL,
email_on_status_min_severity smallint DEFAULT 10 NOT NULL,
email_on_bugnote_min_severity smallint DEFAULT 10 NOT NULL,
email_on_reopened_min_severity smallint DEFAULT 10 NOT NULL,
email_on_closed_min_severity smallint DEFAULT 10 NOT NULL,
email_on_resolved_min_severity smallint DEFAULT 10 NOT NULL,
email_on_feedback_min_severity smallint DEFAULT 10 NOT NULL,
email_on_assigned_min_severity smallint DEFAULT 10 NOT NULL,
email_on_new_min_severity smallint DEFAULT 10 NOT NULL,
email_bugnote_limit smallint DEFAULT 0 NOT NULL,
"language" character varying(32) DEFAULT 'english'::character varying NOT NULL
);
--
-- TOC entry 1716 (class 1259 OID 18356)
-- Dependencies: 1715 6
-- Name: mantis_user_pref_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_user_pref_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2353 (class 0 OID 0)
-- Dependencies: 1716
-- Name: mantis_user_pref_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_user_pref_table_id_seq OWNED BY mantis_user_pref_table.id;
--
-- TOC entry 1717 (class 1259 OID 18358)
-- Dependencies: 2232 2233 6
-- Name: mantis_user_print_pref_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_user_print_pref_table (
user_id integer DEFAULT 0 NOT NULL,
print_pref character varying(27) DEFAULT ''::character varying NOT NULL
);
--
-- TOC entry 1718 (class 1259 OID 18362)
-- Dependencies: 2235 2236 2237 2238 6
-- Name: mantis_user_profile_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_user_profile_table (
id integer NOT NULL,
user_id integer DEFAULT 0 NOT NULL,
platform character varying(32) DEFAULT ''::character varying NOT NULL,
os character varying(32) DEFAULT ''::character varying NOT NULL,
os_build character varying(32) DEFAULT ''::character varying NOT NULL,
description text NOT NULL
);
--
-- TOC entry 1719 (class 1259 OID 18371)
-- Dependencies: 1718 6
-- Name: mantis_user_profile_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_user_profile_table_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2354 (class 0 OID 0)
-- Dependencies: 1719
-- Name: mantis_user_profile_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_user_profile_table_id_seq OWNED BY mantis_user_profile_table.id;
--
-- TOC entry 1720 (class 1259 OID 18373)
-- Dependencies: 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 6
-- Name: mantis_user_table; Type: TABLE; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE TABLE mantis_user_table (
id integer NOT NULL,
username character varying(32) DEFAULT ''::character varying NOT NULL,
realname character varying(64) DEFAULT ''::character varying NOT NULL,
email character varying(64) DEFAULT ''::character varying NOT NULL,
"password" character varying(32) DEFAULT ''::character varying NOT NULL,
date_created timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
last_visit timestamp without time zone DEFAULT '1970-01-01 00:00:01'::timestamp without time zone NOT NULL,
enabled integer DEFAULT 1 NOT NULL,
protected integer DEFAULT 0 NOT NULL,
access_level smallint DEFAULT 10 NOT NULL,
login_count integer DEFAULT 0 NOT NULL,
lost_password_request_count smallint DEFAULT 0 NOT NULL,
failed_login_count smallint DEFAULT 0 NOT NULL,
cookie_string character varying(64) DEFAULT ''::character varying NOT NULL
);
--
-- TOC entry 1721 (class 1259 OID 18388)
-- Dependencies: 1720 6
-- Name: mantis_user_table_id_seq; Type: SEQUENCE; Schema: mantisbt; Owner: -
--
CREATE SEQUENCE mantis_user_table_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
--
-- TOC entry 2355 (class 0 OID 0)
-- Dependencies: 1721
-- Name: mantis_user_table_id_seq; Type: SEQUENCE OWNED BY; Schema: mantisbt; Owner: -
--
ALTER SEQUENCE mantis_user_table_id_seq OWNED BY mantis_user_table.id;
--
-- TOC entry 2063 (class 2604 OID 18390)
-- Dependencies: 1676 1675
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bug_file_table ALTER COLUMN id SET DEFAULT nextval('mantis_bug_file_table_id_seq'::regclass);
--
-- TOC entry 2064 (class 2604 OID 18391)
-- Dependencies: 1678 1677
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bug_history_table ALTER COLUMN id SET DEFAULT nextval('mantis_bug_history_table_id_seq'::regclass);
--
-- TOC entry 2074 (class 2604 OID 18392)
-- Dependencies: 1681 1680
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bug_relationship_table ALTER COLUMN id SET DEFAULT nextval('mantis_bug_relationship_table_id_seq'::regclass);
--
-- TOC entry 2105 (class 2604 OID 18393)
-- Dependencies: 1683 1682
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bug_table ALTER COLUMN id SET DEFAULT nextval('mantis_bug_table_id_seq'::regclass);
--
-- TOC entry 2106 (class 2604 OID 18394)
-- Dependencies: 1685 1684
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bug_text_table ALTER COLUMN id SET DEFAULT nextval('mantis_bug_text_table_id_seq'::regclass);
--
-- TOC entry 2116 (class 2604 OID 18395)
-- Dependencies: 1687 1686
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bugnote_table ALTER COLUMN id SET DEFAULT nextval('mantis_bugnote_table_id_seq'::regclass);
--
-- TOC entry 2117 (class 2604 OID 18396)
-- Dependencies: 1689 1688
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_bugnote_text_table ALTER COLUMN id SET DEFAULT nextval('mantis_bugnote_text_table_id_seq'::regclass);
--
-- TOC entry 2146 (class 2604 OID 18397)
-- Dependencies: 1694 1693
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_custom_field_table ALTER COLUMN id SET DEFAULT nextval('mantis_custom_field_table_id_seq'::regclass);
--
-- TOC entry 2147 (class 2604 OID 18398)
-- Dependencies: 1696 1695
-- Name: email_id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_email_table ALTER COLUMN email_id SET DEFAULT nextval('mantis_email_table_id_seq'::regclass);
--
-- TOC entry 2151 (class 2604 OID 18399)
-- Dependencies: 1698 1697
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_filters_table ALTER COLUMN id SET DEFAULT nextval('mantis_filters_table_id_seq'::regclass);
--
-- TOC entry 2155 (class 2604 OID 18400)
-- Dependencies: 1700 1699
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_news_table ALTER COLUMN id SET DEFAULT nextval('mantis_news_table_id_seq'::regclass);
--
-- TOC entry 2175 (class 2604 OID 18401)
-- Dependencies: 1703 1702
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_project_file_table ALTER COLUMN id SET DEFAULT nextval('mantis_project_file_table_id_seq'::regclass);
--
-- TOC entry 2176 (class 2604 OID 18402)
-- Dependencies: 1706 1705
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_project_table ALTER COLUMN id SET DEFAULT nextval('mantis_project_table_id_seq'::regclass);
--
-- TOC entry 2186 (class 2604 OID 18403)
-- Dependencies: 1709 1708
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_project_version_table ALTER COLUMN id SET DEFAULT nextval('mantis_project_version_table_id_seq'::regclass);
--
-- TOC entry 2199 (class 2604 OID 18404)
-- Dependencies: 1711 1710
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_sponsorship_table ALTER COLUMN id SET DEFAULT nextval('mantis_sponsorship_table_id_seq'::regclass);
--
-- TOC entry 2200 (class 2604 OID 18405)
-- Dependencies: 1713 1712
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_tokens_table ALTER COLUMN id SET DEFAULT nextval('mantis_tokens_table_id_seq'::regclass);
--
-- TOC entry 2231 (class 2604 OID 18406)
-- Dependencies: 1716 1715
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_user_pref_table ALTER COLUMN id SET DEFAULT nextval('mantis_user_pref_table_id_seq'::regclass);
--
-- TOC entry 2234 (class 2604 OID 18407)
-- Dependencies: 1719 1718
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_user_profile_table ALTER COLUMN id SET DEFAULT nextval('mantis_user_profile_table_id_seq'::regclass);
--
-- TOC entry 2252 (class 2604 OID 18408)
-- Dependencies: 1721 1720
-- Name: id; Type: DEFAULT; Schema: mantisbt; Owner: -
--
ALTER TABLE mantis_user_table ALTER COLUMN id SET DEFAULT nextval('mantis_user_table_id_seq'::regclass);
--
-- TOC entry 2256 (class 2606 OID 18410)
-- Dependencies: 1675 1675
-- Name: mantis_bug_file_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_file_table
ADD CONSTRAINT mantis_bug_file_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2260 (class 2606 OID 18412)
-- Dependencies: 1677 1677
-- Name: mantis_bug_history_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_history_table
ADD CONSTRAINT mantis_bug_history_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2262 (class 2606 OID 18414)
-- Dependencies: 1679 1679 1679
-- Name: mantis_bug_monitor_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_monitor_table
ADD CONSTRAINT mantis_bug_monitor_table_pkey PRIMARY KEY (user_id, bug_id);
--
-- TOC entry 2266 (class 2606 OID 18416)
-- Dependencies: 1680 1680
-- Name: mantis_bug_relationship_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_relationship_table
ADD CONSTRAINT mantis_bug_relationship_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2272 (class 2606 OID 18418)
-- Dependencies: 1682 1682
-- Name: mantis_bug_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_table
ADD CONSTRAINT mantis_bug_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2274 (class 2606 OID 18420)
-- Dependencies: 1684 1684
-- Name: mantis_bug_text_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bug_text_table
ADD CONSTRAINT mantis_bug_text_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2278 (class 2606 OID 18422)
-- Dependencies: 1686 1686
-- Name: mantis_bugnote_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bugnote_table
ADD CONSTRAINT mantis_bugnote_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2280 (class 2606 OID 18424)
-- Dependencies: 1688 1688
-- Name: mantis_bugnote_text_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_bugnote_text_table
ADD CONSTRAINT mantis_bugnote_text_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2283 (class 2606 OID 18426)
-- Dependencies: 1690 1690 1690 1690
-- Name: mantis_config_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_config_table
ADD CONSTRAINT mantis_config_table_pkey PRIMARY KEY (config_id, project_id, user_id);
--
-- TOC entry 2285 (class 2606 OID 18428)
-- Dependencies: 1691 1691 1691
-- Name: mantis_custom_field_project_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_custom_field_project_table
ADD CONSTRAINT mantis_custom_field_project_table_pkey PRIMARY KEY (field_id, project_id);
--
-- TOC entry 2288 (class 2606 OID 18430)
-- Dependencies: 1692 1692 1692
-- Name: mantis_custom_field_string_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_custom_field_string_table
ADD CONSTRAINT mantis_custom_field_string_table_pkey PRIMARY KEY (field_id, bug_id);
--
-- TOC entry 2291 (class 2606 OID 18432)
-- Dependencies: 1693 1693
-- Name: mantis_custom_field_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_custom_field_table
ADD CONSTRAINT mantis_custom_field_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2294 (class 2606 OID 18434)
-- Dependencies: 1695 1695
-- Name: mantis_email_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_email_table
ADD CONSTRAINT mantis_email_table_pkey PRIMARY KEY (email_id);
--
-- TOC entry 2296 (class 2606 OID 18436)
-- Dependencies: 1697 1697
-- Name: mantis_filters_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_filters_table
ADD CONSTRAINT mantis_filters_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2298 (class 2606 OID 18438)
-- Dependencies: 1699 1699
-- Name: mantis_news_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_news_table
ADD CONSTRAINT mantis_news_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2300 (class 2606 OID 18440)
-- Dependencies: 1701 1701 1701
-- Name: mantis_project_category_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_project_category_table
ADD CONSTRAINT mantis_project_category_table_pkey PRIMARY KEY (project_id, category);
--
-- TOC entry 2302 (class 2606 OID 18442)
-- Dependencies: 1702 1702
-- Name: mantis_project_file_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_project_file_table
ADD CONSTRAINT mantis_project_file_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2307 (class 2606 OID 18444)
-- Dependencies: 1705 1705
-- Name: mantis_project_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_project_table
ADD CONSTRAINT mantis_project_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2310 (class 2606 OID 18446)
-- Dependencies: 1707 1707 1707
-- Name: mantis_project_user_list_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_project_user_list_table
ADD CONSTRAINT mantis_project_user_list_table_pkey PRIMARY KEY (project_id, user_id);
--
-- TOC entry 2313 (class 2606 OID 18448)
-- Dependencies: 1708 1708
-- Name: mantis_project_version_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_project_version_table
ADD CONSTRAINT mantis_project_version_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2317 (class 2606 OID 18450)
-- Dependencies: 1710 1710
-- Name: mantis_sponsorship_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_sponsorship_table
ADD CONSTRAINT mantis_sponsorship_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2319 (class 2606 OID 18452)
-- Dependencies: 1712 1712
-- Name: mantis_tokens_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_tokens_table
ADD CONSTRAINT mantis_tokens_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2321 (class 2606 OID 18454)
-- Dependencies: 1714 1714
-- Name: mantis_upgrade_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_upgrade_table
ADD CONSTRAINT mantis_upgrade_table_pkey PRIMARY KEY (upgrade_id);
--
-- TOC entry 2323 (class 2606 OID 18456)
-- Dependencies: 1715 1715
-- Name: mantis_user_pref_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_user_pref_table
ADD CONSTRAINT mantis_user_pref_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2325 (class 2606 OID 18458)
-- Dependencies: 1717 1717
-- Name: mantis_user_print_pref_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_user_print_pref_table
ADD CONSTRAINT mantis_user_print_pref_table_pkey PRIMARY KEY (user_id);
--
-- TOC entry 2327 (class 2606 OID 18460)
-- Dependencies: 1718 1718
-- Name: mantis_user_profile_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_user_profile_table
ADD CONSTRAINT mantis_user_profile_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2333 (class 2606 OID 18462)
-- Dependencies: 1720 1720
-- Name: mantis_user_table_pkey; Type: CONSTRAINT; Schema: mantisbt; Owner: -; Tablespace:
--
ALTER TABLE ONLY mantis_user_table
ADD CONSTRAINT mantis_user_table_pkey PRIMARY KEY (id);
--
-- TOC entry 2328 (class 1259 OID 18463)
-- Dependencies: 1720
-- Name: idx_access; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_access ON mantis_user_table USING btree (access_level);
--
-- TOC entry 2275 (class 1259 OID 18464)
-- Dependencies: 1686
-- Name: idx_bug; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug ON mantis_bugnote_table USING btree (bug_id);
--
-- TOC entry 2253 (class 1259 OID 18465)
-- Dependencies: 1675
-- Name: idx_bug_file_bug_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug_file_bug_id ON mantis_bug_file_table USING btree (bug_id);
--
-- TOC entry 2267 (class 1259 OID 18466)
-- Dependencies: 1682
-- Name: idx_bug_fixed_in_version; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug_fixed_in_version ON mantis_bug_table USING btree (fixed_in_version);
--
-- TOC entry 2257 (class 1259 OID 18467)
-- Dependencies: 1677
-- Name: idx_bug_history_bug_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug_history_bug_id ON mantis_bug_history_table USING btree (bug_id);
--
-- TOC entry 2268 (class 1259 OID 18468)
-- Dependencies: 1682
-- Name: idx_bug_sponsorship_total; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug_sponsorship_total ON mantis_bug_table USING btree (sponsorship_total);
--
-- TOC entry 2269 (class 1259 OID 18469)
-- Dependencies: 1682
-- Name: idx_bug_status; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_bug_status ON mantis_bug_table USING btree (status);
--
-- TOC entry 2281 (class 1259 OID 18470)
-- Dependencies: 1690
-- Name: idx_config; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_config ON mantis_config_table USING btree (config_id);
--
-- TOC entry 2286 (class 1259 OID 18471)
-- Dependencies: 1692
-- Name: idx_custom_field_bug; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_custom_field_bug ON mantis_custom_field_string_table USING btree (bug_id);
--
-- TOC entry 2289 (class 1259 OID 18472)
-- Dependencies: 1693
-- Name: idx_custom_field_name; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_custom_field_name ON mantis_custom_field_table USING btree (name);
--
-- TOC entry 2254 (class 1259 OID 18473)
-- Dependencies: 1675
-- Name: idx_diskfile; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_diskfile ON mantis_bug_file_table USING btree (diskfile);
--
-- TOC entry 2292 (class 1259 OID 18474)
-- Dependencies: 1695
-- Name: idx_email_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_email_id ON mantis_email_table USING btree (email_id);
--
-- TOC entry 2329 (class 1259 OID 18475)
-- Dependencies: 1720
-- Name: idx_enable; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_enable ON mantis_user_table USING btree (enabled);
--
-- TOC entry 2258 (class 1259 OID 18476)
-- Dependencies: 1677
-- Name: idx_history_user_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_history_user_id ON mantis_bug_history_table USING btree (user_id);
--
-- TOC entry 2276 (class 1259 OID 18477)
-- Dependencies: 1686
-- Name: idx_last_mod; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_last_mod ON mantis_bugnote_table USING btree (last_modified);
--
-- TOC entry 2270 (class 1259 OID 18478)
-- Dependencies: 1682
-- Name: idx_project; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_project ON mantis_bug_table USING btree (project_id);
--
-- TOC entry 2303 (class 1259 OID 18479)
-- Dependencies: 1705
-- Name: idx_project_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_project_id ON mantis_project_table USING btree (id);
--
-- TOC entry 2304 (class 1259 OID 18480)
-- Dependencies: 1705
-- Name: idx_project_name; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX idx_project_name ON mantis_project_table USING btree (name);
--
-- TOC entry 2308 (class 1259 OID 18481)
-- Dependencies: 1707
-- Name: idx_project_user; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_project_user ON mantis_project_user_list_table USING btree (user_id);
--
-- TOC entry 2311 (class 1259 OID 18482)
-- Dependencies: 1708 1708
-- Name: idx_project_version; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX idx_project_version ON mantis_project_version_table USING btree (project_id, version);
--
-- TOC entry 2305 (class 1259 OID 18483)
-- Dependencies: 1705
-- Name: idx_project_view; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_project_view ON mantis_project_table USING btree (view_state);
--
-- TOC entry 2263 (class 1259 OID 18484)
-- Dependencies: 1680
-- Name: idx_relationship_destination; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_relationship_destination ON mantis_bug_relationship_table USING btree (destination_bug_id);
--
-- TOC entry 2264 (class 1259 OID 18485)
-- Dependencies: 1680
-- Name: idx_relationship_source; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_relationship_source ON mantis_bug_relationship_table USING btree (source_bug_id);
--
-- TOC entry 2314 (class 1259 OID 18486)
-- Dependencies: 1710
-- Name: idx_sponsorship_bug_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_sponsorship_bug_id ON mantis_sponsorship_table USING btree (bug_id);
--
-- TOC entry 2315 (class 1259 OID 18487)
-- Dependencies: 1710
-- Name: idx_sponsorship_user_id; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE INDEX idx_sponsorship_user_id ON mantis_sponsorship_table USING btree (user_id);
--
-- TOC entry 2330 (class 1259 OID 18488)
-- Dependencies: 1720
-- Name: idx_user_cookie_string; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX idx_user_cookie_string ON mantis_user_table USING btree (cookie_string);
--
-- TOC entry 2331 (class 1259 OID 18489)
-- Dependencies: 1720
-- Name: idx_user_username; Type: INDEX; Schema: mantisbt; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX idx_user_username ON mantis_user_table USING btree (username);
--
-- TOC entry 2336 (class 0 OID 0)
-- Dependencies: 6
-- Name: mantis; Type: ACL; Schema: -; Owner: -
--
REVOKE ALL ON SCHEMA mantis FROM PUBLIC;
REVOKE ALL ON SCHEMA mantis FROM "user_Mantis";
GRANT ALL ON SCHEMA mantis TO "user_Mantis";
GRANT ALL ON SCHEMA mantis TO PUBLIC;
-- Completed on 2007-07-07 10:00:18
--
-- PostgreSQL database dump complete
--
From that point forward Mantis seemed to be on its best behaver and working properly.
eGroupWare
eGroupWare was a breeze to install in the beginning. This was the case all along until I had to edit my configuration. At that point I hit a snag, an error message:
db::get_last_insert_id(table=’egw_emailadmin’, field=’ea_profile_id’) not yet implemented for db-type ‘pgsql’ OR no insert operation before
At this point like any good developer intent on getting something to works, I’m annoyed and swearing at the computer about something that should just work. Then I find out, I should have used OIDs in PostgreSQL, but personally I don’t like them so, lets remedy this issue. I dug in to the eGroupWare code running set after set of egrep and viewing the contents of the file. Until I found it, inside of ADODb. The drvier system was using OIDs as primary keys for PostgreSQL. I needed to figure out how to fix this one, so the question came to me. “How did Mantis do it?” it uses the same database framework. I searched through their code, hacked eGroupWare as I went and figured out a working combination. Here are my modifications to the PostgreSQL driver in ADODb (”drivers/adodb-postgres64.inc.php”):
function pg_insert_id($tablename,$fieldname)
{
$query = "SELECT currval('${tablename}_${fieldname}_seq')";
$result=pg_exec($this->_connectionID, $query);
if ($result) {
$arr = @pg_fetch_row($result,0);
pg_freeresult($result);
if (isset($arr[0])) return $arr[0];
}
return false;
}
/* Warning from http://www.php.net/manual/function.pg-getlastoid.php:
Using a OID as a unique identifier is not generally wise.
Unless you are very careful, you might end up with a tuple having
a different OID if a database must be reloaded. */
function _insertid($table,$column)
{
return $this->pg_insert_id($table,$column);
// if (!is_resource($this->_resultid) || get_resource_type($this->_resultid) !== 'pgsql result') return false;
// $oid = pg_getlastoid($this->_resultid);
// to really return the id, we need the table and column-name, else we can only return the oid != id
// return empty($table) || empty($column) ? $oid : $this->GetOne("SELECT $column FROM $table WHERE oid=".(int)$oid);
}