--
--


SET transaction_timeout = 0;
SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--

-- *not* creating schema, since initdb creates it


ALTER SCHEMA public OWNER TO postgres;

--
-- Name: topology; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA topology;


ALTER SCHEMA topology OWNER TO postgres;

--
-- Name: SCHEMA topology; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA topology IS 'PostGIS Topology schema';


--
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;


--
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION postgis IS 'PostGIS geometry and geography spatial types and functions';


--
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;


--
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION postgis_topology IS 'PostGIS topology spatial types and functions';




--
-- Name: active_user; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.active_user (
    id bigint NOT NULL,
    user_id integer,
    date date,
    "time" time without time zone,
    latitude character varying(20),
    longitude character varying(20)
);


ALTER TABLE public.active_user OWNER TO postgres;

--
-- Name: active_user_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.active_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.active_user_id_seq OWNER TO postgres;

--
-- Name: active_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.active_user_id_seq OWNED BY public.active_user.id;


--
-- Name: amc_ward_boundry; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.amc_ward_boundry (
    gid integer NOT NULL,
    ward_name character varying(100),
    zone_name character varying(100),
    ward_no integer,
    zone_no integer,
    area_sq_km numeric,
    area_ha numeric,
    ward character varying(100),
    shape_leng numeric,
    shape_area numeric,
    geom public.geometry(MultiPolygon,32643)
);


ALTER TABLE public.amc_ward_boundry OWNER TO postgres;

--
-- Name: amc_ward_boundry_gid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.amc_ward_boundry_gid_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.amc_ward_boundry_gid_seq OWNER TO postgres;

--
-- Name: amc_ward_boundry_gid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.amc_ward_boundry_gid_seq OWNED BY public.amc_ward_boundry.gid;


--
-- Name: bird_nest; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.bird_nest (
    bird_nest_id integer NOT NULL,
    nest_value character varying(100)
);


ALTER TABLE public.bird_nest OWNER TO postgres;

--
-- Name: buildings; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.buildings (
    gid integer NOT NULL,
    objectid integer,
    unique_id character varying(254),
    locality1 character varying(254),
    name1 character varying(254),
    remarks1 character varying(254),
    name9 character varying(254),
    name10 character varying(254),
    shape_leng numeric,
    shape_area numeric,
    geom public.geometry(MultiPolygonZM,32643),
    ward_name text,
    ward_id integer
);


ALTER TABLE public.buildings OWNER TO postgres;

--
-- Name: buildings_gid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.buildings_gid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.buildings_gid_seq OWNER TO postgres;

--
-- Name: buildings_gid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.buildings_gid_seq OWNED BY public.buildings.gid;


--
-- Name: condition; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.condition (
    id integer NOT NULL,
    condition_name character varying(200)
);


ALTER TABLE public.condition OWNER TO postgres;

--
-- Name: no_permission; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.no_permission (
    id bigint NOT NULL,
    uid character varying(50),
    entered_date date,
    entered_time time without time zone,
    lat1 character varying(100),
    lon1 character varying(100),
    lat2 character varying(100),
    lon2 character varying(100),
    lat3 character varying(100),
    lon3 character varying(100),
    lat4 character varying(100),
    lon4 character varying(100),
    lat5 character varying(100),
    lon5 character varying(100),
    name character varying(100),
    reason character varying(200),
    email character varying(100),
    geom public.geometry(Polygon,4326),
    approxnooftreesinpremise character varying(100)
);


ALTER TABLE public.no_permission OWNER TO postgres;

--
-- Name: no_permission_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.no_permission_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.no_permission_id_seq OWNER TO postgres;

--
-- Name: no_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.no_permission_id_seq OWNED BY public.no_permission.id;


--
-- Name: ownership; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ownership (
    id integer NOT NULL,
    ownership_name character varying(200)
);


ALTER TABLE public.ownership OWNER TO postgres;

--
-- Name: path_details; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.path_details (
    id bigint NOT NULL,
    user_id integer,
    latitude character varying(20),
    longitude character varying(20),
    date date,
    "time" time without time zone
);


ALTER TABLE public.path_details OWNER TO postgres;

--
-- Name: path_details_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.path_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.path_details_id_seq OWNER TO postgres;

--
-- Name: path_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.path_details_id_seq OWNED BY public.path_details.id;


--
-- Name: random_count; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.random_count (
    id bigint NOT NULL,
    dates date,
    random_count integer
);


ALTER TABLE public.random_count OWNER TO postgres;

--
-- Name: random_count_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.random_count_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.random_count_id_seq OWNER TO postgres;

--
-- Name: random_count_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.random_count_id_seq OWNED BY public.random_count.id;


--
-- Name: remarks; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.remarks (
    id integer NOT NULL,
    remark_name character varying(200)
);


ALTER TABLE public.remarks OWNER TO postgres;

--
-- Name: remarks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.remarks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.remarks_id_seq OWNER TO postgres;

--
-- Name: remarks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.remarks_id_seq OWNED BY public.remarks.id;


--
-- Name: scope_of_plantation; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.scope_of_plantation (
    id bigint NOT NULL,
    latitude double precision,
    longitude double precision,
    entered_date date,
    entered_time time without time zone,
    google_address text,
    user_id integer
);


ALTER TABLE public.scope_of_plantation OWNER TO postgres;

--
-- Name: scope_of_plantation_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.scope_of_plantation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.scope_of_plantation_id_seq OWNER TO postgres;

--
-- Name: scope_of_plantation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.scope_of_plantation_id_seq OWNED BY public.scope_of_plantation.id;


--
-- Name: spacial_comment; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.spacial_comment (
    special_comment_id integer NOT NULL,
    special_comment character varying(100)
);


ALTER TABLE public.spacial_comment OWNER TO postgres;

--
-- Name: treedetailsentered; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treedetailsentered (
    user_id integer NOT NULL,
    tree_id integer NOT NULL,
    latitude double precision,
    longitude double precision,
    grith_cm double precision NOT NULL,
    height_mtr integer NOT NULL,
    condition_id integer DEFAULT 5 NOT NULL,
    ownership_id integer NOT NULL,
    societyname character varying(200) NOT NULL,
    roadname character varying(200) NOT NULL,
    entered_date date,
    entered_time time without time zone,
    tree_details_id bigint NOT NULL,
    googleaddress character varying(400) NOT NULL,
    updated_date date,
    qc_updated_time time without time zone,
    updated_by integer,
    qc_done integer DEFAULT 0,
    qc_status character(3),
    qc_final_submitted integer DEFAULT 0,
    qc_updated_date date,
    geom public.geometry(Point,4326),
    version2 character varying(20),
    user_seq_id character varying(20),
    old_latitude double precision,
    old_longitude double precision,
    drag_distance character varying(50),
    qc_old_latitude double precision,
    qc_old_longitude double precision,
    qc_drag_distance character varying(50) DEFAULT '0'::character varying,
    allocated_ward character varying(10) DEFAULT '0'::character varying,
    within_boundary character varying(10) DEFAULT '0'::character varying,
    new_or_old character varying(20) DEFAULT 'old'::character varying,
    grid character varying(50) DEFAULT 'na'::character varying,
    lat2 double precision,
    lon2 double precision,
    geom_line public.geometry(LineString,4326),
    geom2 public.geometry(Point,4326),
    dist double precision,
    other_name character varying(200),
    bla_imbal_id integer,
    canopy_diameter double precision,
    other_remarks character varying(200),
    remarks_id integer,
    dist_from_prev_tree integer,
    special_comment_id integer,
    bird_nest integer,
    resurvey_done integer DEFAULT 0,
    un_submit_date date,
    un_submit_time time without time zone,
    un_updated_by bigint,
    comment_un text,
    bo_qc_submit_date date,
    bo_qc_submit_time time without time zone,
    bo_qc_done_by integer,
    comment_bo_qc text,
    bo_rare_qc_date date,
    bo_rare_qc_time time without time zone,
    bo_rare_qc_doneby integer,
    bo_rare_qc_comment text,
    age double precision,
    date_of_plantation character varying(10),
    client_name text,
    contractor_name text,
    treename character varying(100),
    ownership_name character varying,
    ownership_contact_no character varying,
    manual_tree_details_id bigint DEFAULT 0,
    is_verified integer DEFAULT 0
);


ALTER TABLE public.treedetailsentered OWNER TO postgres;

--
-- Name: trees; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.trees (
    id integer NOT NULL,
    geom public.geometry(Point,32643),
    oid integer,
    sr_no text,
    gps_no text,
    user_name text,
    local_name text,
    other_name text,
    girth_cm numeric(15,5),
    height_m numeric(15,5),
    canopy_dia_m numeric(15,5),
    condition text,
    other_remarks text,
    dist_frm_p numeric(15,5),
    ownership text,
    society_name text,
    road_name text,
    existing_t text,
    bird_nest boolean,
    date_time timestamp without time zone,
    feat_name text,
    datafile text,
    data_dictionary text,
    gnss_height double precision,
    northing double precision,
    easting double precision,
    point_id integer,
    balanced boolean,
    remarks text,
    special_collar text,
    ward_name text,
    ward_id integer,
    qc_comment text,
    client_comment text,
    qc_2 text,
    botanical_name text,
    common_name text,
    saar_uid text,
    phenology text,
    economic_i text,
    family_g text,
    colour_of text,
    flowering text,
    canopy_typ text,
    carbon_seq text,
    is_rare boolean DEFAULT false,
    age double precision,
    is_heritage integer DEFAULT 0,
    entered_date text,
    entered_time text,
    origin text,
    host_plant text
);


ALTER TABLE public.trees OWNER TO postgres;

--
-- Name: treeusers; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treeusers (
    password character varying(100) NOT NULL,
    first_name character varying(50) NOT NULL,
    last_name character varying(50) NOT NULL,
    email character varying(50) NOT NULL,
    mobile_no character varying(50) NOT NULL,
    uid integer NOT NULL,
    user_type character varying(20),
    sqid integer DEFAULT 0 NOT NULL,
    syncid integer DEFAULT 0 NOT NULL,
    imei1 character varying(200) DEFAULT 0 NOT NULL,
    imei2 character varying(200) DEFAULT 0 NOT NULL,
    address character varying(256),
    city character varying(256),
    state character varying(256),
    pincode character varying(20),
    creation_date date DEFAULT ('now'::text)::date,
    enabled integer DEFAULT 1,
    map_type character varying(50),
    icon_type character varying(50),
    unique_id character varying(1000),
    encrypted_password character varying(1000),
    salt character varying(100),
    isadminrole character varying(100),
    isenabled character varying(100),
    created_at character varying(100),
    allocated_ward integer DEFAULT 0
);


ALTER TABLE public.treeusers OWNER TO postgres;

--
-- Name: wards; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.wards (
    id bigint NOT NULL,
    geom public.geometry(MultiPolygon,32643),
    objectid integer DEFAULT 0,
    name text,
    name_mr text,
    remarks text,
    zones integer DEFAULT 0,
    status character varying(50)
);


ALTER TABLE public.wards OWNER TO postgres;

--
-- Name: total_trees; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW public.total_trees AS
 SELECT td.tree_details_id,
    td.is_verified,
    td.qc_done,
    td.geom,
    t.girth_cm,
    t.height_m,
    t.canopy_dia_m,
    t.other_remarks,
    t.dist_frm_p,
    t.ownership,
    t.society_name,
    t.road_name,
    t.existing_t,
    t.bird_nest,
    t.date_time,
    t.feat_name,
    t.datafile,
    t.data_dictionary,
    t.gnss_height,
    t.northing,
    t.easting,
    t.point_id,
    t.balanced,
    t.remarks,
    t.special_collar,
    t.ward_name,
    t.ward_id,
    t.qc_comment,
    t.client_comment,
    t.qc_2,
    t.botanical_name,
    t.common_name,
    t.saar_uid,
    t.phenology,
    t.economic_i,
    t.family_g,
    t.colour_of,
    t.flowering,
    t.canopy_typ,
    t.carbon_seq,
    t.is_rare,
    t.is_heritage,
    t.age,
    t.entered_date,
    t.entered_time,
    t.origin,
    t.condition,
    t.user_name,
    t.local_name,
    t.other_name,
    w.name AS ward,
    ''::text AS del_stamp,
    '0'::text AS deleted_by,
    ''::character varying AS delete_remarks,
    false AS is_deleted
   FROM (((public.treedetailsentered td
     LEFT JOIN public.treeusers tu ON ((td.user_id = tu.uid)))
     LEFT JOIN public.trees t ON ((td.tree_details_id = (t.saar_uid)::integer)))
     LEFT JOIN public.wards w ON ((t.ward_id = w.id)));


ALTER VIEW public.total_trees OWNER TO postgres;

--
-- Name: treebal_imbalance; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treebal_imbalance (
    balance_id integer NOT NULL,
    isbalance character varying(50) NOT NULL
);


ALTER TABLE public.treebal_imbalance OWNER TO postgres;

--
-- Name: treedetailsentered_bkp_26102025; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treedetailsentered_bkp_26102025 (
    user_id integer,
    tree_id integer,
    latitude double precision,
    longitude double precision,
    grith_cm double precision,
    height_mtr integer,
    condition_id integer,
    ownership_id integer,
    societyname character varying(200),
    roadname character varying(200),
    entered_date date,
    entered_time time without time zone,
    tree_details_id bigint,
    googleaddress character varying(400),
    updated_date date,
    qc_updated_time time without time zone,
    updated_by integer,
    qc_done integer,
    qc_status character(3),
    qc_final_submitted integer,
    qc_updated_date date,
    geom public.geometry(Point,4326),
    version2 character varying(20),
    user_seq_id character varying(20),
    old_latitude double precision,
    old_longitude double precision,
    drag_distance character varying(50),
    qc_old_latitude double precision,
    qc_old_longitude double precision,
    qc_drag_distance character varying(50),
    allocated_ward character varying(10),
    within_boundary character varying(10),
    new_or_old character varying(20),
    grid character varying(50),
    lat2 double precision,
    lon2 double precision,
    geom_line public.geometry(LineString,4326),
    geom2 public.geometry(Point,4326),
    dist double precision,
    other_name character varying(200),
    bla_imbal_id integer,
    canopy_diameter double precision,
    other_remarks character varying(200),
    remarks_id integer,
    dist_from_prev_tree integer,
    special_comment_id integer,
    bird_nest integer,
    resurvey_done integer,
    un_submit_date date,
    un_submit_time time without time zone,
    un_updated_by bigint,
    comment_un text,
    bo_qc_submit_date date,
    bo_qc_submit_time time without time zone,
    bo_qc_done_by integer,
    comment_bo_qc text,
    bo_rare_qc_date date,
    bo_rare_qc_time time without time zone,
    bo_rare_qc_doneby integer,
    bo_rare_qc_comment text,
    age double precision,
    date_of_plantation character varying(10),
    client_name text,
    contractor_name text,
    treename character varying(100),
    ownership_name character varying,
    ownership_contact_no character varying,
    manual_tree_details_id bigint,
    is_verified integer
);


ALTER TABLE public.treedetailsentered_bkp_26102025 OWNER TO postgres;

--
-- Name: treedetailsentered_tree_details_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.treedetailsentered_tree_details_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.treedetailsentered_tree_details_id_seq OWNER TO postgres;

--
-- Name: treedetailsentered_tree_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.treedetailsentered_tree_details_id_seq OWNED BY public.treedetailsentered.tree_details_id;


--
-- Name: treelist; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.treelist (
    tree_name character varying(30),
    comman_name character varying(50),
    family character varying(30),
    phenology character varying(100),
    economic character varying(20),
    flowering character varying(20),
    color character varying(20),
    botanical character varying(200),
    tree_id integer NOT NULL,
    is_rare integer DEFAULT 0,
    priority integer,
    wood_density character varying(200),
    growth_factor double precision,
    gujarati_name character varying(200)
);


ALTER TABLE public.treelist OWNER TO postgres;

--
-- Name: treelist_tree_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.treelist_tree_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.treelist_tree_id_seq OWNER TO postgres;

--
-- Name: treelist_tree_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.treelist_tree_id_seq OWNED BY public.treelist.tree_id;


--
-- Name: trees_history; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.trees_history (
    id bigint NOT NULL,
    geom public.geometry(Point,32643),
    oid integer,
    sr_no text,
    gps_no text,
    user_name text,
    local_name text,
    other_name text,
    girth_cm numeric(15,5),
    height_m numeric(15,5),
    canopy_dia_m numeric(15,5),
    condition text,
    other_remarks text,
    dist_frm_p numeric(15,5),
    ownership text,
    society_name text,
    road_name text,
    existing_t text,
    bird_nest boolean,
    date_time timestamp without time zone,
    feat_name text,
    datafile text,
    data_dictionary text,
    gnss_height double precision,
    northing double precision,
    easting double precision,
    point_id integer,
    balanced boolean,
    remarks text,
    special_collar text,
    ward_name text,
    ward_id integer,
    qc_comment text,
    client_comment text,
    qc_2 text,
    botanical_name text,
    common_name text,
    saar_uid text,
    phenology text,
    economic_i text,
    family_g text,
    colour_of text,
    flowering text,
    canopy_typ text,
    carbon_seq text,
    is_rare boolean DEFAULT false,
    age double precision,
    is_heritage integer DEFAULT 0,
    entered_date text,
    entered_time text,
    origin text,
    host_plant text,
    del_stamp text,
    deleted_by text,
    delete_remarks text
);


ALTER TABLE public.trees_history OWNER TO postgres;

--
-- Name: trees_history_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.trees_history_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.trees_history_id_seq OWNER TO postgres;

--
-- Name: trees_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.trees_history_id_seq OWNED BY public.trees_history.id;


--
-- Name: trees_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.trees_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.trees_id_seq OWNER TO postgres;

--
-- Name: trees_id_seq1; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.trees_id_seq1
    START WITH 1
    INCREMENT BY 1
    MINVALUE 0
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.trees_id_seq1 OWNER TO postgres;

--
-- Name: trees_id_seq1; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.trees_id_seq1 OWNED BY public.trees.id;


--
-- Name: treeusers_uid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.treeusers_uid_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.treeusers_uid_seq OWNER TO postgres;

--
-- Name: treeusers_uid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.treeusers_uid_seq OWNED BY public.treeusers.uid;


--
-- Name: user_feedback; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_feedback (
    uf_id integer NOT NULL,
    uf_name text,
    uf_email text,
    uf_mobile text,
    uf_comment text,
    uf_mail_sent boolean DEFAULT false,
    uf_feedback_date timestamp without time zone,
    uf_mailsent_userid integer,
    uf_mailsent_comment text,
    uf_mailsent_date timestamp without time zone,
    uf_feedback_delete boolean DEFAULT false,
    uf_tree_id integer,
    uf_saar_uid text,
    uf_comment_common_name text,
    uf_comment_girth text,
    uf_comment_canopy text,
    uf_comment_location text,
    uf_comment_splcomment text,
    uf_comment_height text,
    uf_comment_treecondition text,
    uf_comment_balanced text,
    uf_comment_botname text,
    uf_comment_localname text
);


ALTER TABLE public.user_feedback OWNER TO postgres;

--
-- Name: user_feedback_uf_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.user_feedback_uf_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.user_feedback_uf_id_seq OWNER TO postgres;

--
-- Name: user_feedback_uf_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.user_feedback_uf_id_seq OWNED BY public.user_feedback.uf_id;


--
-- Name: user_roles; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_roles (
    role_type character varying(20) NOT NULL,
    user_role character varying(50)
);


ALTER TABLE public.user_roles OWNER TO postgres;

--
-- Name: wards_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.wards_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.wards_id_seq OWNER TO postgres;

--
-- Name: wards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.wards_id_seq OWNED BY public.wards.id;


--
-- Name: zones; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.zones (
    id bigint NOT NULL,
    name character varying,
    name_mr character varying
);


ALTER TABLE public.zones OWNER TO postgres;

--
-- Name: zones_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.zones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.zones_id_seq OWNER TO postgres;

--
-- Name: zones_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.zones_id_seq OWNED BY public.zones.id;


--
-- Name: active_user id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.active_user ALTER COLUMN id SET DEFAULT nextval('public.active_user_id_seq'::regclass);


--
-- Name: amc_ward_boundry gid; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.amc_ward_boundry ALTER COLUMN gid SET DEFAULT nextval('public.amc_ward_boundry_gid_seq'::regclass);


--
-- Name: buildings gid; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.buildings ALTER COLUMN gid SET DEFAULT nextval('public.buildings_gid_seq'::regclass);


--
-- Name: no_permission id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.no_permission ALTER COLUMN id SET DEFAULT nextval('public.no_permission_id_seq'::regclass);


--
-- Name: path_details id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.path_details ALTER COLUMN id SET DEFAULT nextval('public.path_details_id_seq'::regclass);


--
-- Name: random_count id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.random_count ALTER COLUMN id SET DEFAULT nextval('public.random_count_id_seq'::regclass);


--
-- Name: remarks id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.remarks ALTER COLUMN id SET DEFAULT nextval('public.remarks_id_seq'::regclass);


--
-- Name: scope_of_plantation id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.scope_of_plantation ALTER COLUMN id SET DEFAULT nextval('public.scope_of_plantation_id_seq'::regclass);


--
-- Name: treedetailsentered tree_details_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treedetailsentered ALTER COLUMN tree_details_id SET DEFAULT nextval('public.treedetailsentered_tree_details_id_seq'::regclass);


--
-- Name: treelist tree_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treelist ALTER COLUMN tree_id SET DEFAULT nextval('public.treelist_tree_id_seq'::regclass);


--
-- Name: trees id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.trees ALTER COLUMN id SET DEFAULT nextval('public.trees_id_seq1'::regclass);


--
-- Name: trees_history id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.trees_history ALTER COLUMN id SET DEFAULT nextval('public.trees_history_id_seq'::regclass);


--
-- Name: treeusers uid; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treeusers ALTER COLUMN uid SET DEFAULT nextval('public.treeusers_uid_seq'::regclass);


--
-- Name: user_feedback uf_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_feedback ALTER COLUMN uf_id SET DEFAULT nextval('public.user_feedback_uf_id_seq'::regclass);


--
-- Name: wards id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.wards ALTER COLUMN id SET DEFAULT nextval('public.wards_id_seq'::regclass);


--
-- Name: zones id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.zones ALTER COLUMN id SET DEFAULT nextval('public.zones_id_seq'::regclass);


--
-- Name: active_user active_user_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.active_user
    ADD CONSTRAINT active_user_pkey PRIMARY KEY (id);


--
-- Name: amc_ward_boundry amc_ward_boundry_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.amc_ward_boundry
    ADD CONSTRAINT amc_ward_boundry_pkey PRIMARY KEY (gid);


--
-- Name: bird_nest bird_nest_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.bird_nest
    ADD CONSTRAINT bird_nest_pkey PRIMARY KEY (bird_nest_id);


--
-- Name: buildings buildings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.buildings
    ADD CONSTRAINT buildings_pkey PRIMARY KEY (gid);


--
-- Name: condition condition_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.condition
    ADD CONSTRAINT condition_pkey PRIMARY KEY (id);


--
-- Name: no_permission no_permission_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.no_permission
    ADD CONSTRAINT no_permission_pkey PRIMARY KEY (id);


--
-- Name: ownership ownership_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ownership
    ADD CONSTRAINT ownership_pkey PRIMARY KEY (id);


--
-- Name: path_details path_details_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.path_details
    ADD CONSTRAINT path_details_pkey PRIMARY KEY (id);


--
-- Name: random_count random_count_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.random_count
    ADD CONSTRAINT random_count_pkey PRIMARY KEY (id);


--
-- Name: remarks remarks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.remarks
    ADD CONSTRAINT remarks_pkey PRIMARY KEY (id);


--
-- Name: scope_of_plantation scope_of_plantation_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.scope_of_plantation
    ADD CONSTRAINT scope_of_plantation_pkey PRIMARY KEY (id);


--
-- Name: spacial_comment spacial_comment_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.spacial_comment
    ADD CONSTRAINT spacial_comment_pkey PRIMARY KEY (special_comment_id);


--
-- Name: treedetailsentered treedetailsentered_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treedetailsentered
    ADD CONSTRAINT treedetailsentered_pkey PRIMARY KEY (tree_details_id);


--
-- Name: treelist treelist_pkey1; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treelist
    ADD CONSTRAINT treelist_pkey1 PRIMARY KEY (tree_id);


--
-- Name: trees trees_pkey1; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.trees
    ADD CONSTRAINT trees_pkey1 PRIMARY KEY (id);


--
-- Name: trees_history trees_pkey2; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.trees_history
    ADD CONSTRAINT trees_pkey2 PRIMARY KEY (id);


--
-- Name: treeusers treeusers_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treeusers
    ADD CONSTRAINT treeusers_pkey PRIMARY KEY (uid);


--
-- Name: user_feedback user_feedback_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_feedback
    ADD CONSTRAINT user_feedback_pkey PRIMARY KEY (uf_id);


--
-- Name: user_roles user_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_roles
    ADD CONSTRAINT user_roles_pkey PRIMARY KEY (role_type);


--
-- Name: wards wards_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.wards
    ADD CONSTRAINT wards_pkey PRIMARY KEY (id);


--
-- Name: zones zones_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.zones
    ADD CONSTRAINT zones_pkey PRIMARY KEY (id);


--
-- Name: amc_ward_boundry_geom_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX amc_ward_boundry_geom_idx ON public.amc_ward_boundry USING gist (geom);


--
-- Name: idx_tree_girth_cm; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_girth_cm ON public.trees USING btree (girth_cm);


--
-- Name: idx_tree_height_m; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_height_m ON public.trees USING btree (height_m);


--
-- Name: idx_tree_local_name; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_local_name ON public.trees USING btree (local_name);


--
-- Name: idx_tree_ownership_; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_ownership_ ON public.trees USING btree (ownership);


--
-- Name: idx_tree_road_name; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_road_name ON public.trees USING btree (road_name);


--
-- Name: idx_tree_society_na; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_society_na ON public.trees USING btree (society_name);


--
-- Name: idx_tree_ward_name; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_tree_ward_name ON public.trees USING btree (ward_name);


--
-- Name: idx_trees_geom; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_trees_geom ON public.trees USING gist (geom);

ALTER TABLE public.trees CLUSTER ON idx_trees_geom;


--
-- Name: ind_entered_date; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX ind_entered_date ON public.treedetailsentered USING btree (entered_date);


--
-- Name: ind_latitude; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX ind_latitude ON public.treedetailsentered USING btree (latitude);


--
-- Name: ind_longitude; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX ind_longitude ON public.treedetailsentered USING btree (longitude);


--
-- Name: ind_user_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX ind_user_id ON public.treedetailsentered USING btree (user_id);


--
-- Name: trees_canopy_dia_m_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_canopy_dia_m_idx ON public.trees USING btree (canopy_dia_m);


--
-- Name: trees_colour_of_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_colour_of_idx ON public.trees USING btree (colour_of);


--
-- Name: trees_common_name_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_common_name_idx ON public.trees USING btree (common_name);


--
-- Name: trees_condition_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_condition_idx ON public.trees USING btree (condition);


--
-- Name: trees_economic_i_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_economic_i_idx ON public.trees USING btree (economic_i);


--
-- Name: trees_family_g_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_family_g_idx ON public.trees USING btree (family_g);


--
-- Name: trees_flowering_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_flowering_idx ON public.trees USING btree (flowering);


--
-- Name: trees_phenology_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_phenology_idx ON public.trees USING btree (phenology);


--
-- Name: trees_remarks_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_remarks_idx ON public.trees USING btree (remarks);


--
-- Name: trees_special_collar_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_special_collar_idx ON public.trees USING btree (special_collar);


--
-- Name: trees_ward_id_idx; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX trees_ward_id_idx ON public.trees USING btree (ward_id);


--
-- Name: treedetailsentered treedetailsentered_updated_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.treedetailsentered
    ADD CONSTRAINT treedetailsentered_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.treeusers(uid);


--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--

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


--
--

