--
--

-- Started on 2012-02-10 14:27:45

SET escape_string_warning = off;

--
-- TOC entry 508 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

-- CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;

-- ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;


--
-- TOC entry 140 (class 1259 OID 16397)
-- Dependencies: 6
-- Name: hibernate_sequence; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE hibernate_sequence
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.hibernate_sequence OWNER TO postgres;



--
-- TOC entry 141 (class 1259 OID 16399)
-- Dependencies: 6
-- Name: jbpm4_deployment; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_deployment (
    dbid_ bigint NOT NULL,
    name_ text,
    timestamp_ bigint,
    state_ character varying(255)
);


ALTER TABLE public.jbpm4_deployment OWNER TO jbpm;

--
-- TOC entry 142 (class 1259 OID 16405)
-- Dependencies: 6
-- Name: jbpm4_deployprop; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_deployprop (
    dbid_ bigint NOT NULL,
    deployment_ bigint,
    objname_ character varying(255),
    key_ character varying(255),
    stringval_ character varying(255),
    longval_ bigint
);


ALTER TABLE public.jbpm4_deployprop OWNER TO jbpm;

--
-- TOC entry 143 (class 1259 OID 16411)
-- Dependencies: 6
-- Name: jbpm4_execution; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_execution (
    dbid_ bigint NOT NULL,
    class_ character varying(255) NOT NULL,
    dbversion_ integer NOT NULL,
    activityname_ character varying(255),
    procdefid_ character varying(255),
    hasvars_ boolean,
    name_ character varying(255),
    key_ character varying(255),
    id_ character varying(255),
    state_ character varying(255),
    susphiststate_ character varying(255),
    priority_ integer,
    hisactinst_ bigint,
    parent_ bigint,
    instance_ bigint,
    superexec_ bigint,
    subprocinst_ bigint,
    parent_idx_ integer
);


ALTER TABLE public.jbpm4_execution OWNER TO jbpm;

--
-- TOC entry 144 (class 1259 OID 16417)
-- Dependencies: 6
-- Name: jbpm4_hist_actinst; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_hist_actinst (
    dbid_ bigint NOT NULL,
    class_ character varying(255) NOT NULL,
    dbversion_ integer NOT NULL,
    hproci_ bigint,
    type_ character varying(255),
    execution_ character varying(255),
    activity_name_ character varying(255),
    start_ timestamp without time zone,
    end_ timestamp without time zone,
    duration_ bigint,
    transition_ character varying(255),
    nextidx_ integer,
    htask_ bigint
);


ALTER TABLE public.jbpm4_hist_actinst OWNER TO jbpm;

--
-- TOC entry 145 (class 1259 OID 16423)
-- Dependencies: 6
-- Name: jbpm4_hist_detail; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_hist_detail (
    dbid_ bigint NOT NULL,
    class_ character varying(255) NOT NULL,
    dbversion_ integer NOT NULL,
    userid_ character varying(255),
    time_ timestamp without time zone,
    hproci_ bigint,
    hprociidx_ integer,
    hacti_ bigint,
    hactiidx_ integer,
    htask_ bigint,
    htaskidx_ integer,
    hvar_ bigint,
    hvaridx_ integer,
    message_ text,
    old_str_ character varying(255),
    new_str_ character varying(255),
    old_int_ integer,
    new_int_ integer,
    old_time_ timestamp without time zone,
    new_time_ timestamp without time zone,
    parent_ bigint,
    parent_idx_ integer
);


ALTER TABLE public.jbpm4_hist_detail OWNER TO jbpm;

--
-- TOC entry 146 (class 1259 OID 16429)
-- Dependencies: 6
-- Name: jbpm4_hist_procinst; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_hist_procinst (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    id_ character varying(255),
    procdefid_ character varying(255),
    key_ character varying(255),
    start_ timestamp without time zone,
    end_ timestamp without time zone,
    duration_ bigint,
    state_ character varying(255),
    endactivity_ character varying(255),
    nextidx_ integer
);


ALTER TABLE public.jbpm4_hist_procinst OWNER TO jbpm;

--
-- TOC entry 147 (class 1259 OID 16435)
-- Dependencies: 6
-- Name: jbpm4_hist_task; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_hist_task (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    execution_ character varying(255),
    outcome_ character varying(255),
    assignee_ character varying(255),
    priority_ integer,
    state_ character varying(255),
    create_ timestamp without time zone,
    end_ timestamp without time zone,
    duration_ bigint,
    nextidx_ integer,
    supertask_ bigint
);


ALTER TABLE public.jbpm4_hist_task OWNER TO jbpm;

--
-- TOC entry 148 (class 1259 OID 16441)
-- Dependencies: 6
-- Name: jbpm4_hist_var; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_hist_var (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    procinstid_ character varying(255),
    executionid_ character varying(255),
    varname_ character varying(255),
    value_ character varying(255),
    hproci_ bigint,
    htask_ bigint
);


ALTER TABLE public.jbpm4_hist_var OWNER TO jbpm;

--
-- TOC entry 149 (class 1259 OID 16447)
-- Dependencies: 6
-- Name: jbpm4_id_group; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_id_group (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    id_ character varying(255),
    name_ character varying(255),
    type_ character varying(255),
    parent_ bigint
);


ALTER TABLE public.jbpm4_id_group OWNER TO jbpm;

--
-- TOC entry 150 (class 1259 OID 16453)
-- Dependencies: 6
-- Name: jbpm4_id_membership; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_id_membership (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    user_ bigint,
    group_ bigint,
    name_ character varying(255)
);


ALTER TABLE public.jbpm4_id_membership OWNER TO jbpm;

--
-- TOC entry 151 (class 1259 OID 16456)
-- Dependencies: 6
-- Name: jbpm4_id_user; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_id_user (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    id_ character varying(255),
    password_ character varying(255),
    givenname_ character varying(255),
    familyname_ character varying(255),
    businessemail_ character varying(255)
);


ALTER TABLE public.jbpm4_id_user OWNER TO jbpm;

--
-- TOC entry 152 (class 1259 OID 16462)
-- Dependencies: 6
-- Name: jbpm4_job; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_job (
    dbid_ bigint NOT NULL,
    class_ character varying(255) NOT NULL,
    dbversion_ integer NOT NULL,
    duedate_ timestamp without time zone,
    state_ character varying(255),
    isexclusive_ boolean,
    lockowner_ character varying(255),
    lockexptime_ timestamp without time zone,
    exception_ text,
    retries_ integer,
    processinstance_ bigint,
    execution_ bigint,
    cfg_ bigint,
    signal_ character varying(255),
    event_ character varying(255),
    repeat_ character varying(255)
);


ALTER TABLE public.jbpm4_job OWNER TO jbpm;

--
-- TOC entry 153 (class 1259 OID 16468)
-- Dependencies: 6
-- Name: jbpm4_lob; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_lob (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    blob_value_ oid,
    deployment_ bigint,
    name_ text
);


ALTER TABLE public.jbpm4_lob OWNER TO jbpm;

--
-- TOC entry 154 (class 1259 OID 16474)
-- Dependencies: 6
-- Name: jbpm4_participation; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_participation (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    groupid_ character varying(255),
    userid_ character varying(255),
    type_ character varying(255),
    task_ bigint,
    swimlane_ bigint
);


ALTER TABLE public.jbpm4_participation OWNER TO jbpm;

--
-- TOC entry 155 (class 1259 OID 16480)
-- Dependencies: 6
-- Name: jbpm4_property; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_property (
    key_ character varying(255) NOT NULL,
    version_ integer NOT NULL,
    value_ character varying(255)
);


ALTER TABLE public.jbpm4_property OWNER TO jbpm;

--
-- TOC entry 156 (class 1259 OID 16486)
-- Dependencies: 6
-- Name: jbpm4_swimlane; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_swimlane (
    dbid_ bigint NOT NULL,
    dbversion_ integer NOT NULL,
    name_ character varying(255),
    assignee_ character varying(255),
    execution_ bigint
);


ALTER TABLE public.jbpm4_swimlane OWNER TO jbpm;

--
-- TOC entry 157 (class 1259 OID 16492)
-- Dependencies: 6
-- Name: jbpm4_task; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_task (
    dbid_ bigint NOT NULL,
    class_ character(1) NOT NULL,
    dbversion_ integer NOT NULL,
    name_ character varying(255),
    descr_ text,
    state_ character varying(255),
    susphiststate_ character varying(255),
    assignee_ character varying(255),
    form_ character varying(255),
    priority_ integer,
    create_ timestamp without time zone,
    duedate_ timestamp without time zone,
    progress_ integer,
    signalling_ boolean,
    execution_id_ character varying(255),
    activity_name_ character varying(255),
    hasvars_ boolean,
    supertask_ bigint,
    execution_ bigint,
    procinst_ bigint,
    swimlane_ bigint,
    taskdefname_ character varying(255)
);


ALTER TABLE public.jbpm4_task OWNER TO jbpm;

--
-- TOC entry 158 (class 1259 OID 16498)
-- Dependencies: 6
-- Name: jbpm4_variable; Type: TABLE; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE TABLE jbpm4_variable (
    dbid_ bigint NOT NULL,
    class_ character varying(255) NOT NULL,
    dbversion_ integer NOT NULL,
    key_ character varying(255),
    converter_ character varying(255),
    hist_ boolean,
    execution_ bigint,
    task_ bigint,
    lob_ bigint,
    date_value_ timestamp without time zone,
    double_value_ double precision,
    classname_ character varying(255),
    long_value_ bigint,
    string_value_ character varying(255),
    text_value_ text,
    exesys_ bigint
);


ALTER TABLE public.jbpm4_variable OWNER TO jbpm;

--
-- TOC entry 1840 (class 2606 OID 16505)
-- Dependencies: 141 141
-- Name: jbpm4_deployment_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_deployment
    ADD CONSTRAINT jbpm4_deployment_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1843 (class 2606 OID 16507)
-- Dependencies: 142 142
-- Name: jbpm4_deployprop_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_deployprop
    ADD CONSTRAINT jbpm4_deployprop_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1849 (class 2606 OID 16509)
-- Dependencies: 143 143
-- Name: jbpm4_execution_id__key; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT jbpm4_execution_id__key UNIQUE (id_);


--
-- TOC entry 1851 (class 2606 OID 16511)
-- Dependencies: 143 143
-- Name: jbpm4_execution_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT jbpm4_execution_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1855 (class 2606 OID 16513)
-- Dependencies: 144 144
-- Name: jbpm4_hist_actinst_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_hist_actinst
    ADD CONSTRAINT jbpm4_hist_actinst_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1861 (class 2606 OID 16515)
-- Dependencies: 145 145
-- Name: jbpm4_hist_detail_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_hist_detail
    ADD CONSTRAINT jbpm4_hist_detail_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1863 (class 2606 OID 16517)
-- Dependencies: 146 146
-- Name: jbpm4_hist_procinst_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_hist_procinst
    ADD CONSTRAINT jbpm4_hist_procinst_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1866 (class 2606 OID 16519)
-- Dependencies: 147 147
-- Name: jbpm4_hist_task_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_hist_task
    ADD CONSTRAINT jbpm4_hist_task_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1870 (class 2606 OID 16521)
-- Dependencies: 148 148
-- Name: jbpm4_hist_var_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_hist_var
    ADD CONSTRAINT jbpm4_hist_var_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1873 (class 2606 OID 16523)
-- Dependencies: 149 149
-- Name: jbpm4_id_group_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_id_group
    ADD CONSTRAINT jbpm4_id_group_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1877 (class 2606 OID 16525)
-- Dependencies: 150 150
-- Name: jbpm4_id_membership_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_id_membership
    ADD CONSTRAINT jbpm4_id_membership_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1879 (class 2606 OID 16527)
-- Dependencies: 151 151
-- Name: jbpm4_id_user_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_id_user
    ADD CONSTRAINT jbpm4_id_user_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1887 (class 2606 OID 16529)
-- Dependencies: 152 152
-- Name: jbpm4_job_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_job
    ADD CONSTRAINT jbpm4_job_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1890 (class 2606 OID 16531)
-- Dependencies: 153 153
-- Name: jbpm4_lob_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_lob
    ADD CONSTRAINT jbpm4_lob_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1893 (class 2606 OID 16533)
-- Dependencies: 154 154
-- Name: jbpm4_participation_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_participation
    ADD CONSTRAINT jbpm4_participation_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1895 (class 2606 OID 16535)
-- Dependencies: 155 155
-- Name: jbpm4_property_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_property
    ADD CONSTRAINT jbpm4_property_pkey PRIMARY KEY (key_);


--
-- TOC entry 1898 (class 2606 OID 16537)
-- Dependencies: 156 156
-- Name: jbpm4_swimlane_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_swimlane
    ADD CONSTRAINT jbpm4_swimlane_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1901 (class 2606 OID 16539)
-- Dependencies: 157 157
-- Name: jbpm4_task_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_task
    ADD CONSTRAINT jbpm4_task_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1907 (class 2606 OID 16541)
-- Dependencies: 158 158
-- Name: jbpm4_variable_pkey; Type: CONSTRAINT; Schema: public; Owner: jbpm; Tablespace: 
--

ALTER TABLE ONLY jbpm4_variable
    ADD CONSTRAINT jbpm4_variable_pkey PRIMARY KEY (dbid_);


--
-- TOC entry 1841 (class 1259 OID 16542)
-- Dependencies: 142
-- Name: idx_deplprop_depl; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_deplprop_depl ON jbpm4_deployprop USING btree (deployment_);


--
-- TOC entry 1844 (class 1259 OID 16543)
-- Dependencies: 143
-- Name: idx_exec_instance; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_exec_instance ON jbpm4_execution USING btree (instance_);


--
-- TOC entry 1845 (class 1259 OID 16544)
-- Dependencies: 143
-- Name: idx_exec_parent; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_exec_parent ON jbpm4_execution USING btree (parent_);


--
-- TOC entry 1846 (class 1259 OID 16545)
-- Dependencies: 143
-- Name: idx_exec_subpi; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_exec_subpi ON jbpm4_execution USING btree (subprocinst_);


--
-- TOC entry 1847 (class 1259 OID 16546)
-- Dependencies: 143
-- Name: idx_exec_superexec; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_exec_superexec ON jbpm4_execution USING btree (superexec_);


--
-- TOC entry 1871 (class 1259 OID 16547)
-- Dependencies: 149
-- Name: idx_group_parent; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_group_parent ON jbpm4_id_group USING btree (parent_);


--
-- TOC entry 1852 (class 1259 OID 16548)
-- Dependencies: 144
-- Name: idx_hacti_hproci; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hacti_hproci ON jbpm4_hist_actinst USING btree (hproci_);


--
-- TOC entry 1856 (class 1259 OID 16549)
-- Dependencies: 145
-- Name: idx_hdet_hacti; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hdet_hacti ON jbpm4_hist_detail USING btree (hacti_);


--
-- TOC entry 1857 (class 1259 OID 16550)
-- Dependencies: 145
-- Name: idx_hdet_hproci; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hdet_hproci ON jbpm4_hist_detail USING btree (hproci_);


--
-- TOC entry 1858 (class 1259 OID 16551)
-- Dependencies: 145
-- Name: idx_hdet_htask; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hdet_htask ON jbpm4_hist_detail USING btree (htask_);


--
-- TOC entry 1859 (class 1259 OID 16552)
-- Dependencies: 145
-- Name: idx_hdet_hvar; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hdet_hvar ON jbpm4_hist_detail USING btree (hvar_);


--
-- TOC entry 1864 (class 1259 OID 16553)
-- Dependencies: 147
-- Name: idx_hsupert_sub; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hsupert_sub ON jbpm4_hist_task USING btree (supertask_);


--
-- TOC entry 1853 (class 1259 OID 16554)
-- Dependencies: 144
-- Name: idx_hti_htask; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hti_htask ON jbpm4_hist_actinst USING btree (htask_);


--
-- TOC entry 1867 (class 1259 OID 16555)
-- Dependencies: 148
-- Name: idx_hvar_hproci; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hvar_hproci ON jbpm4_hist_var USING btree (hproci_);


--
-- TOC entry 1868 (class 1259 OID 16556)
-- Dependencies: 148
-- Name: idx_hvar_htask; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_hvar_htask ON jbpm4_hist_var USING btree (htask_);


--
-- TOC entry 1880 (class 1259 OID 16557)
-- Dependencies: 152
-- Name: idx_job_cfg; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_job_cfg ON jbpm4_job USING btree (cfg_);


--
-- TOC entry 1881 (class 1259 OID 16558)
-- Dependencies: 152
-- Name: idx_job_exe; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_job_exe ON jbpm4_job USING btree (execution_);


--
-- TOC entry 1882 (class 1259 OID 16559)
-- Dependencies: 152
-- Name: idx_job_prinst; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_job_prinst ON jbpm4_job USING btree (processinstance_);


--
-- TOC entry 1883 (class 1259 OID 16560)
-- Dependencies: 152
-- Name: idx_jobduedate; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_jobduedate ON jbpm4_job USING btree (duedate_);


--
-- TOC entry 1884 (class 1259 OID 16561)
-- Dependencies: 152
-- Name: idx_joblockexp; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_joblockexp ON jbpm4_job USING btree (lockexptime_);


--
-- TOC entry 1885 (class 1259 OID 16562)
-- Dependencies: 152
-- Name: idx_jobretries; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_jobretries ON jbpm4_job USING btree (retries_);


--
-- TOC entry 1888 (class 1259 OID 16563)
-- Dependencies: 153
-- Name: idx_lob_deployment; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_lob_deployment ON jbpm4_lob USING btree (deployment_);


--
-- TOC entry 1874 (class 1259 OID 16564)
-- Dependencies: 150
-- Name: idx_mem_group; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_mem_group ON jbpm4_id_membership USING btree (group_);


--
-- TOC entry 1875 (class 1259 OID 16565)
-- Dependencies: 150
-- Name: idx_mem_user; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_mem_user ON jbpm4_id_membership USING btree (user_);


--
-- TOC entry 1891 (class 1259 OID 16566)
-- Dependencies: 154
-- Name: idx_part_task; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_part_task ON jbpm4_participation USING btree (task_);


--
-- TOC entry 1896 (class 1259 OID 16567)
-- Dependencies: 156
-- Name: idx_swimlane_exec; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_swimlane_exec ON jbpm4_swimlane USING btree (execution_);


--
-- TOC entry 1899 (class 1259 OID 16568)
-- Dependencies: 157
-- Name: idx_task_supertask; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_task_supertask ON jbpm4_task USING btree (supertask_);


--
-- TOC entry 1902 (class 1259 OID 16569)
-- Dependencies: 158
-- Name: idx_var_execution; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_var_execution ON jbpm4_variable USING btree (execution_);


--
-- TOC entry 1903 (class 1259 OID 16570)
-- Dependencies: 158
-- Name: idx_var_exesys; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_var_exesys ON jbpm4_variable USING btree (exesys_);


--
-- TOC entry 1904 (class 1259 OID 16571)
-- Dependencies: 158
-- Name: idx_var_lob; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_var_lob ON jbpm4_variable USING btree (lob_);


--
-- TOC entry 1905 (class 1259 OID 16572)
-- Dependencies: 158
-- Name: idx_var_task; Type: INDEX; Schema: public; Owner: jbpm; Tablespace: 
--

CREATE INDEX idx_var_task ON jbpm4_variable USING btree (task_);


--
-- TOC entry 1908 (class 2606 OID 16573)
-- Dependencies: 142 1839 141
-- Name: fk_deplprop_depl; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_deployprop
    ADD CONSTRAINT fk_deplprop_depl FOREIGN KEY (deployment_) REFERENCES jbpm4_deployment(dbid_);


--
-- TOC entry 1909 (class 2606 OID 16578)
-- Dependencies: 143 143 1850
-- Name: fk_exec_instance; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT fk_exec_instance FOREIGN KEY (instance_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1910 (class 2606 OID 16583)
-- Dependencies: 1850 143 143
-- Name: fk_exec_parent; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT fk_exec_parent FOREIGN KEY (parent_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1911 (class 2606 OID 16588)
-- Dependencies: 143 143 1850
-- Name: fk_exec_subpi; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT fk_exec_subpi FOREIGN KEY (subprocinst_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1912 (class 2606 OID 16593)
-- Dependencies: 143 1850 143
-- Name: fk_exec_superexec; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_execution
    ADD CONSTRAINT fk_exec_superexec FOREIGN KEY (superexec_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1922 (class 2606 OID 16598)
-- Dependencies: 1872 149 149
-- Name: fk_group_parent; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_id_group
    ADD CONSTRAINT fk_group_parent FOREIGN KEY (parent_) REFERENCES jbpm4_id_group(dbid_);


--
-- TOC entry 1913 (class 2606 OID 16603)
-- Dependencies: 144 1862 146
-- Name: fk_hacti_hproci; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_actinst
    ADD CONSTRAINT fk_hacti_hproci FOREIGN KEY (hproci_) REFERENCES jbpm4_hist_procinst(dbid_);


--
-- TOC entry 1915 (class 2606 OID 16608)
-- Dependencies: 145 1854 144
-- Name: fk_hdetail_hacti; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_detail
    ADD CONSTRAINT fk_hdetail_hacti FOREIGN KEY (hacti_) REFERENCES jbpm4_hist_actinst(dbid_);


--
-- TOC entry 1916 (class 2606 OID 16613)
-- Dependencies: 1862 145 146
-- Name: fk_hdetail_hproci; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_detail
    ADD CONSTRAINT fk_hdetail_hproci FOREIGN KEY (hproci_) REFERENCES jbpm4_hist_procinst(dbid_);


--
-- TOC entry 1917 (class 2606 OID 16618)
-- Dependencies: 147 145 1865
-- Name: fk_hdetail_htask; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_detail
    ADD CONSTRAINT fk_hdetail_htask FOREIGN KEY (htask_) REFERENCES jbpm4_hist_task(dbid_);


--
-- TOC entry 1918 (class 2606 OID 16623)
-- Dependencies: 1869 148 145
-- Name: fk_hdetail_hvar; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_detail
    ADD CONSTRAINT fk_hdetail_hvar FOREIGN KEY (hvar_) REFERENCES jbpm4_hist_var(dbid_);


--
-- TOC entry 1919 (class 2606 OID 16628)
-- Dependencies: 147 1865 147
-- Name: fk_hsupert_sub; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_task
    ADD CONSTRAINT fk_hsupert_sub FOREIGN KEY (supertask_) REFERENCES jbpm4_hist_task(dbid_);


--
-- TOC entry 1914 (class 2606 OID 16633)
-- Dependencies: 1865 144 147
-- Name: fk_hti_htask; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_actinst
    ADD CONSTRAINT fk_hti_htask FOREIGN KEY (htask_) REFERENCES jbpm4_hist_task(dbid_);


--
-- TOC entry 1920 (class 2606 OID 16638)
-- Dependencies: 148 146 1862
-- Name: fk_hvar_hproci; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_var
    ADD CONSTRAINT fk_hvar_hproci FOREIGN KEY (hproci_) REFERENCES jbpm4_hist_procinst(dbid_);


--
-- TOC entry 1921 (class 2606 OID 16643)
-- Dependencies: 1865 148 147
-- Name: fk_hvar_htask; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_hist_var
    ADD CONSTRAINT fk_hvar_htask FOREIGN KEY (htask_) REFERENCES jbpm4_hist_task(dbid_);


--
-- TOC entry 1925 (class 2606 OID 16648)
-- Dependencies: 1889 153 152
-- Name: fk_job_cfg; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_job
    ADD CONSTRAINT fk_job_cfg FOREIGN KEY (cfg_) REFERENCES jbpm4_lob(dbid_);


--
-- TOC entry 1926 (class 2606 OID 16653)
-- Dependencies: 1839 153 141
-- Name: fk_lob_deployment; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_lob
    ADD CONSTRAINT fk_lob_deployment FOREIGN KEY (deployment_) REFERENCES jbpm4_deployment(dbid_);


--
-- TOC entry 1923 (class 2606 OID 16658)
-- Dependencies: 149 150 1872
-- Name: fk_mem_group; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_id_membership
    ADD CONSTRAINT fk_mem_group FOREIGN KEY (group_) REFERENCES jbpm4_id_group(dbid_);


--
-- TOC entry 1924 (class 2606 OID 16663)
-- Dependencies: 1878 151 150
-- Name: fk_mem_user; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_id_membership
    ADD CONSTRAINT fk_mem_user FOREIGN KEY (user_) REFERENCES jbpm4_id_user(dbid_);


--
-- TOC entry 1927 (class 2606 OID 16668)
-- Dependencies: 156 1897 154
-- Name: fk_part_swimlane; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_participation
    ADD CONSTRAINT fk_part_swimlane FOREIGN KEY (swimlane_) REFERENCES jbpm4_swimlane(dbid_);


--
-- TOC entry 1928 (class 2606 OID 16673)
-- Dependencies: 1900 157 154
-- Name: fk_part_task; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_participation
    ADD CONSTRAINT fk_part_task FOREIGN KEY (task_) REFERENCES jbpm4_task(dbid_);


--
-- TOC entry 1929 (class 2606 OID 16678)
-- Dependencies: 1850 143 156
-- Name: fk_swimlane_exec; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_swimlane
    ADD CONSTRAINT fk_swimlane_exec FOREIGN KEY (execution_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1930 (class 2606 OID 16683)
-- Dependencies: 157 1900 157
-- Name: fk_task_supertask; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_task
    ADD CONSTRAINT fk_task_supertask FOREIGN KEY (supertask_) REFERENCES jbpm4_task(dbid_);


--
-- TOC entry 1931 (class 2606 OID 16688)
-- Dependencies: 156 1897 157
-- Name: fk_task_swiml; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_task
    ADD CONSTRAINT fk_task_swiml FOREIGN KEY (swimlane_) REFERENCES jbpm4_swimlane(dbid_);


--
-- TOC entry 1932 (class 2606 OID 16693)
-- Dependencies: 1850 143 158
-- Name: fk_var_execution; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_variable
    ADD CONSTRAINT fk_var_execution FOREIGN KEY (execution_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1933 (class 2606 OID 16698)
-- Dependencies: 1850 158 143
-- Name: fk_var_exesys; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_variable
    ADD CONSTRAINT fk_var_exesys FOREIGN KEY (exesys_) REFERENCES jbpm4_execution(dbid_);


--
-- TOC entry 1934 (class 2606 OID 16703)
-- Dependencies: 1889 158 153
-- Name: fk_var_lob; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_variable
    ADD CONSTRAINT fk_var_lob FOREIGN KEY (lob_) REFERENCES jbpm4_lob(dbid_);


--
-- TOC entry 1935 (class 2606 OID 16708)
-- Dependencies: 158 157 1900
-- Name: fk_var_task; Type: FK CONSTRAINT; Schema: public; Owner: jbpm
--

ALTER TABLE ONLY jbpm4_variable
    ADD CONSTRAINT fk_var_task FOREIGN KEY (task_) REFERENCES jbpm4_task(dbid_);


--
-- TOC entry 1940 (class 0 OID 0)
-- Dependencies: 6
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2012-02-10 14:27:46

--
--

