--
-- NOTE:
--
-- File paths need to be edited. Search for $$PATH$$ and
-- replace it with the path to the directory containing
-- the extracted data files.
--
--
-- PostgreSQL database dump
--

-- Dumped from database version 15.7 (Debian 15.7-1.pgdg120+1)
-- Dumped by pg_dump version 16.2

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

DROP DATABASE irrigation_report;
--
-- Name: irrigation_report; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE irrigation_report WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'en_US.UTF-8';


ALTER DATABASE irrigation_report OWNER TO postgres;

\connect irrigation_report

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

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

CREATE SCHEMA content;


ALTER SCHEMA content OWNER TO postgres;

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

CREATE SCHEMA dss;


ALTER SCHEMA dss OWNER TO postgres;

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

CREATE SCHEMA file;


ALTER SCHEMA file OWNER TO postgres;

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

CREATE SCHEMA map;


ALTER SCHEMA map OWNER TO postgres;

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

CREATE SCHEMA report;


ALTER SCHEMA report OWNER TO postgres;

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

CREATE SCHEMA "user";


ALTER SCHEMA "user" OWNER TO postgres;

--
-- 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: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;


--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';


--
-- Name: segmentize(public.geometry); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.segmentize(p_geom public.geometry) RETURNS SETOF public.geometry
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY (
        SELECT ST_LineSubstring(p_geom, startfrac, LEAST(endfrac, 1 ))::geometry AS geom
        FROM (
            SELECT i, (10 * i) / ST_Length(p_geom) AS startfrac,
                      (10 * (i+1)) / ST_Length(p_geom) AS endfrac
            FROM generate_series(0, floor( ST_Length(p_geom) / 10 )::integer ) AS t(i)
            -- skip last i if line length is exact multiple of sublen
            WHERE (10 * i) / ST_Length(p_geom) <> 1.0
        ) AS d2
    );
END;
$$;


ALTER FUNCTION public.segmentize(p_geom public.geometry) OWNER TO postgres;

--
-- Name: show_sublines(public.geometry); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.show_sublines(p_sublen public.geometry) RETURNS SETOF public.geometry
    LANGUAGE plpgsql
    AS $$
DECLARE
    subline_geometry geometry;
BEGIN
    FOR subline_geometry IN (
        WITH data(sublen) AS (VALUES (p_sublen))
        SELECT ST_LineSubstring(sublen, 0.15, 0.8) AS sub_geom
        FROM data
    )
    LOOP
        RETURN NEXT subline_geometry;
    END LOOP;
    RETURN;
END;
$$;


ALTER FUNCTION public.show_sublines(p_sublen public.geometry) OWNER TO postgres;

--
-- Name: single_line(uuid); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.single_line(p_id uuid) RETURNS SETOF public.geometry
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY (
--         SELECT (s).geom AS geom
		SELECT ST_Transform((s).geom, 4326) AS geom
        FROM master.irrigations
        CROSS JOIN LATERAL ST_DumpSegments(ST_Transform(geom, 3857)) s
        WHERE id = p_id
    );
END;
$$;


ALTER FUNCTION public.single_line(p_id uuid) OWNER TO postgres;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: article; Type: TABLE; Schema: content; Owner: postgres
--

CREATE TABLE content.article (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    title character varying(255) NOT NULL,
    "desc" character varying(255) NOT NULL,
    image character varying(255) NOT NULL,
    location character varying(255),
    author character varying(255) NOT NULL,
    tags character varying(255),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE content.article OWNER TO postgres;

--
-- Name: upload_dump; Type: TABLE; Schema: file; Owner: postgres
--

CREATE TABLE file.upload_dump (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    filename character varying(255) NOT NULL,
    file_type character varying(255) NOT NULL,
    size bigint,
    folder character varying(50) NOT NULL,
    file_url character varying(255) NOT NULL,
    uploader_ip character varying(255),
    uploader_status boolean,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE file.upload_dump OWNER TO postgres;

--
-- Name: city; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.city (
    id integer NOT NULL,
    name character varying(30) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE map.city OWNER TO postgres;

--
-- Name: district; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.district (
    id integer NOT NULL,
    city_id integer NOT NULL,
    name character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE map.district OWNER TO postgres;

--
-- Name: irrigations; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.irrigations (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    district_id integer NOT NULL,
    sub_district_id bigint NOT NULL,
    name character varying NOT NULL,
    type character varying NOT NULL,
    length double precision NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone,
    geom public.geometry(LineString,4326)
);


ALTER TABLE map.irrigations OWNER TO postgres;

--
-- Name: irrigations_section; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.irrigations_section (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    irrigation_id uuid NOT NULL,
    name character varying NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone,
    geom public.geometry(LineString,4326) NOT NULL
);


ALTER TABLE map.irrigations_section OWNER TO postgres;

--
-- Name: irrigations_segment; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.irrigations_segment (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    irrigation_id uuid NOT NULL,
    irrigation_section_id uuid NOT NULL,
    name character varying NOT NULL,
    length double precision,
    center_point public.geometry(Point,4326),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone,
    geom public.geometry(LineString,4326) NOT NULL,
    geojson character varying(1000)
);


ALTER TABLE map.irrigations_segment OWNER TO postgres;

--
-- Name: sub_district; Type: TABLE; Schema: map; Owner: postgres
--

CREATE TABLE map.sub_district (
    id bigint NOT NULL,
    city_id integer NOT NULL,
    district_id integer NOT NULL,
    name character varying NOT NULL,
    type character varying NOT NULL,
    area_km2 double precision,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone,
    geom public.geometry(MultiPolygon,4326)
);


ALTER TABLE map.sub_district OWNER TO postgres;

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

CREATE TABLE public.city (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.city OWNER TO postgres;

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

CREATE TABLE public.districts (
    id uuid NOT NULL,
    city_id uuid NOT NULL,
    name character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.districts OWNER TO postgres;

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

CREATE TABLE public.dss_analytic_data (
    id uuid NOT NULL,
    report_list_id uuid NOT NULL,
    score double precision NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.dss_analytic_data OWNER TO postgres;

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

CREATE TABLE public.failed_jobs (
    id bigint NOT NULL,
    uuid character varying(255) NOT NULL,
    connection text NOT NULL,
    queue text NOT NULL,
    payload text NOT NULL,
    exception text NOT NULL,
    failed_at timestamp(0) without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
);


ALTER TABLE public.failed_jobs OWNER TO postgres;

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

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


ALTER SEQUENCE public.failed_jobs_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.failed_jobs_id_seq OWNED BY public.failed_jobs.id;


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

CREATE TABLE public.irrigations (
    id uuid NOT NULL,
    district_id uuid NOT NULL,
    sub_district_id uuid NOT NULL,
    length character varying(255) NOT NULL,
    width character varying(255) NOT NULL,
    geom public.geography(LineString,4326) NOT NULL,
    type character varying(255) NOT NULL,
    name character varying(255) NOT NULL,
    condition character varying(255) NOT NULL,
    canal character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.irrigations OWNER TO postgres;

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

CREATE TABLE public.master_irrigations (
    id integer NOT NULL,
    geom public.geometry(MultiLineStringZ,4326),
    objectid bigint,
    oid_ bigint,
    jaringan_i character varying(254),
    saluran character varying(254),
    panjang__m double precision,
    desa_kel character varying(50),
    kecamatan character varying(50),
    keterangan character varying(50),
    shape_leng double precision
);


ALTER TABLE public.master_irrigations OWNER TO postgres;

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

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


ALTER SEQUENCE public.master_irrigations_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.master_irrigations_id_seq OWNED BY public.master_irrigations.id;


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

CREATE TABLE public.master_sub_district (
    id integer NOT NULL,
    geom public.geometry(MultiPolygon,32749),
    objectid_1 integer,
    objectid integer,
    admin_ double precision,
    admin_id double precision,
    desa character varying(30),
    kecamatan character varying(30),
    kabupaten character varying(30),
    provinsi character varying(30),
    area_km2 double precision
);


ALTER TABLE public.master_sub_district OWNER TO postgres;

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

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


ALTER SEQUENCE public.master_sub_district_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.master_sub_district_id_seq OWNED BY public.master_sub_district.id;


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

CREATE TABLE public.migrations (
    id integer NOT NULL,
    migration character varying(255) NOT NULL,
    batch integer NOT NULL
);


ALTER TABLE public.migrations OWNER TO postgres;

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

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


ALTER SEQUENCE public.migrations_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id;


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

CREATE TABLE public.password_reset_tokens (
    email character varying(255) NOT NULL,
    token character varying(255) NOT NULL,
    created_at timestamp(0) without time zone
);


ALTER TABLE public.password_reset_tokens OWNER TO postgres;

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

CREATE TABLE public.personal_access_tokens (
    id bigint NOT NULL,
    tokenable_type character varying(255) NOT NULL,
    tokenable_id bigint NOT NULL,
    name character varying(255) NOT NULL,
    token character varying(64) NOT NULL,
    abilities text,
    last_used_at timestamp(0) without time zone,
    expires_at timestamp(0) without time zone,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.personal_access_tokens OWNER TO postgres;

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

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


ALTER SEQUENCE public.personal_access_tokens_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.personal_access_tokens_id_seq OWNED BY public.personal_access_tokens.id;


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

CREATE TABLE public.report_list (
    id uuid NOT NULL,
    segment_id uuid NOT NULL,
    user_id uuid NOT NULL,
    status_id uuid NOT NULL,
    no_ticket character varying(255) NOT NULL,
    note character varying(255) NOT NULL,
    maintenance_by character varying(255) NOT NULL,
    survey_status character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.report_list OWNER TO postgres;

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

CREATE TABLE public.status (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.status OWNER TO postgres;

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

CREATE TABLE public.sub_districts (
    id uuid NOT NULL,
    district_id uuid NOT NULL,
    name character varying(255) NOT NULL,
    type character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.sub_districts OWNER TO postgres;

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

CREATE TABLE public.user_roles (
    id uuid NOT NULL,
    name character varying(255) NOT NULL,
    code character varying(255) NOT NULL,
    "desc" character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.user_roles OWNER TO postgres;

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

CREATE TABLE public.users (
    id uuid NOT NULL,
    urole_id uuid NOT NULL,
    username character varying(255) NOT NULL,
    email character varying(255) NOT NULL,
    password character varying(255) NOT NULL,
    fullname character varying(255) NOT NULL,
    shortname character varying(255) NOT NULL,
    avatar character varying(255) NOT NULL,
    gender character varying(255) NOT NULL,
    age character varying(255) NOT NULL,
    phone character varying(255) NOT NULL,
    status character varying(255) NOT NULL,
    email_verified_at timestamp(0) without time zone,
    remember_token character varying(100),
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE public.users OWNER TO postgres;

--
-- Name: report_list; Type: TABLE; Schema: report; Owner: postgres
--

CREATE TABLE report.report_list (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    user_id uuid NOT NULL,
    status_id uuid NOT NULL,
    no_ticket character varying(255) NOT NULL,
    maintenance_by character varying(255),
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE report.report_list OWNER TO postgres;

--
-- Name: report_photo; Type: TABLE; Schema: report; Owner: postgres
--

CREATE TABLE report.report_photo (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    report_segment_id uuid NOT NULL,
    upload_dump_id uuid NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE report.report_photo OWNER TO postgres;

--
-- Name: report_segment; Type: TABLE; Schema: report; Owner: postgres
--

CREATE TABLE report.report_segment (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    report_id uuid NOT NULL,
    segment_id uuid NOT NULL,
    level character varying(15) NOT NULL,
    type character varying(15),
    rate character varying(255),
    comment character varying(255),
    note character varying(255),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
    updated_at timestamp without time zone
);


ALTER TABLE report.report_segment OWNER TO postgres;

--
-- Name: status; Type: TABLE; Schema: report; Owner: postgres
--

CREATE TABLE report.status (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    name character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE report.status OWNER TO postgres;

--
-- Name: password_reset_tokens; Type: TABLE; Schema: user; Owner: postgres
--

CREATE TABLE "user".password_reset_tokens (
    email character varying(255) NOT NULL,
    token character varying(255),
    created_at timestamp without time zone
);


ALTER TABLE "user".password_reset_tokens OWNER TO postgres;

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

CREATE TABLE "user".user_roles (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    name character varying(255) NOT NULL,
    code character varying(255) NOT NULL,
    "desc" character varying(255) NOT NULL,
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone
);


ALTER TABLE "user".user_roles OWNER TO postgres;

--
-- Name: users; Type: TABLE; Schema: user; Owner: postgres
--

CREATE TABLE "user".users (
    id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
    urole_id uuid NOT NULL,
    username character varying(255) NOT NULL,
    email character varying(255) NOT NULL,
    password text NOT NULL,
    fullname character varying(255) NOT NULL,
    avatar character varying(255),
    created_at timestamp(0) without time zone,
    updated_at timestamp(0) without time zone,
    email_verified_at timestamp without time zone,
    phone character varying(13)[]
);


ALTER TABLE "user".users OWNER TO postgres;

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

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


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

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


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

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


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

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


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

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


--
-- Data for Name: article; Type: TABLE DATA; Schema: content; Owner: postgres
--

COPY content.article (id, title, "desc", image, location, author, tags, created_at, updated_at) FROM stdin;
\.
COPY content.article (id, title, "desc", image, location, author, tags, created_at, updated_at) FROM '$$PATH$$/4506.dat';

--
-- Data for Name: upload_dump; Type: TABLE DATA; Schema: file; Owner: postgres
--

COPY file.upload_dump (id, filename, file_type, size, folder, file_url, uploader_ip, uploader_status, created_at, updated_at) FROM stdin;
\.
COPY file.upload_dump (id, filename, file_type, size, folder, file_url, uploader_ip, uploader_status, created_at, updated_at) FROM '$$PATH$$/4507.dat';

--
-- Data for Name: city; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.city (id, name, created_at, updated_at) FROM stdin;
\.
COPY map.city (id, name, created_at, updated_at) FROM '$$PATH$$/4508.dat';

--
-- Data for Name: district; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.district (id, city_id, name, created_at, updated_at) FROM stdin;
\.
COPY map.district (id, city_id, name, created_at, updated_at) FROM '$$PATH$$/4509.dat';

--
-- Data for Name: irrigations; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.irrigations (id, district_id, sub_district_id, name, type, length, created_at, updated_at, geom) FROM stdin;
\.
COPY map.irrigations (id, district_id, sub_district_id, name, type, length, created_at, updated_at, geom) FROM '$$PATH$$/4510.dat';

--
-- Data for Name: irrigations_section; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.irrigations_section (id, irrigation_id, name, created_at, updated_at, geom) FROM stdin;
\.
COPY map.irrigations_section (id, irrigation_id, name, created_at, updated_at, geom) FROM '$$PATH$$/4511.dat';

--
-- Data for Name: irrigations_segment; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.irrigations_segment (id, irrigation_id, irrigation_section_id, name, length, center_point, created_at, updated_at, geom, geojson) FROM stdin;
\.
COPY map.irrigations_segment (id, irrigation_id, irrigation_section_id, name, length, center_point, created_at, updated_at, geom, geojson) FROM '$$PATH$$/4512.dat';

--
-- Data for Name: sub_district; Type: TABLE DATA; Schema: map; Owner: postgres
--

COPY map.sub_district (id, city_id, district_id, name, type, area_km2, created_at, updated_at, geom) FROM stdin;
\.
COPY map.sub_district (id, city_id, district_id, name, type, area_km2, created_at, updated_at, geom) FROM '$$PATH$$/4513.dat';

--
-- Data for Name: city; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.city (id, name, created_at, updated_at) FROM stdin;
\.
COPY public.city (id, name, created_at, updated_at) FROM '$$PATH$$/4514.dat';

--
-- Data for Name: districts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.districts (id, city_id, name, created_at, updated_at) FROM stdin;
\.
COPY public.districts (id, city_id, name, created_at, updated_at) FROM '$$PATH$$/4515.dat';

--
-- Data for Name: dss_analytic_data; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.dss_analytic_data (id, report_list_id, score, created_at, updated_at) FROM stdin;
\.
COPY public.dss_analytic_data (id, report_list_id, score, created_at, updated_at) FROM '$$PATH$$/4516.dat';

--
-- Data for Name: failed_jobs; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.failed_jobs (id, uuid, connection, queue, payload, exception, failed_at) FROM stdin;
\.
COPY public.failed_jobs (id, uuid, connection, queue, payload, exception, failed_at) FROM '$$PATH$$/4517.dat';

--
-- Data for Name: irrigations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.irrigations (id, district_id, sub_district_id, length, width, geom, type, name, condition, canal, created_at, updated_at) FROM stdin;
\.
COPY public.irrigations (id, district_id, sub_district_id, length, width, geom, type, name, condition, canal, created_at, updated_at) FROM '$$PATH$$/4519.dat';

--
-- Data for Name: master_irrigations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.master_irrigations (id, geom, objectid, oid_, jaringan_i, saluran, panjang__m, desa_kel, kecamatan, keterangan, shape_leng) FROM stdin;
\.
COPY public.master_irrigations (id, geom, objectid, oid_, jaringan_i, saluran, panjang__m, desa_kel, kecamatan, keterangan, shape_leng) FROM '$$PATH$$/4520.dat';

--
-- Data for Name: master_sub_district; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.master_sub_district (id, geom, objectid_1, objectid, admin_, admin_id, desa, kecamatan, kabupaten, provinsi, area_km2) FROM stdin;
\.
COPY public.master_sub_district (id, geom, objectid_1, objectid, admin_, admin_id, desa, kecamatan, kabupaten, provinsi, area_km2) FROM '$$PATH$$/4522.dat';

--
-- Data for Name: migrations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.migrations (id, migration, batch) FROM stdin;
\.
COPY public.migrations (id, migration, batch) FROM '$$PATH$$/4524.dat';

--
-- Data for Name: password_reset_tokens; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.password_reset_tokens (email, token, created_at) FROM stdin;
\.
COPY public.password_reset_tokens (email, token, created_at) FROM '$$PATH$$/4526.dat';

--
-- Data for Name: personal_access_tokens; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.personal_access_tokens (id, tokenable_type, tokenable_id, name, token, abilities, last_used_at, expires_at, created_at, updated_at) FROM stdin;
\.
COPY public.personal_access_tokens (id, tokenable_type, tokenable_id, name, token, abilities, last_used_at, expires_at, created_at, updated_at) FROM '$$PATH$$/4527.dat';

--
-- Data for Name: report_list; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.report_list (id, segment_id, user_id, status_id, no_ticket, note, maintenance_by, survey_status, created_at, updated_at) FROM stdin;
\.
COPY public.report_list (id, segment_id, user_id, status_id, no_ticket, note, maintenance_by, survey_status, created_at, updated_at) FROM '$$PATH$$/4529.dat';

--
-- Data for Name: spatial_ref_sys; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) FROM stdin;
\.
COPY public.spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) FROM '$$PATH$$/4230.dat';

--
-- Data for Name: status; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.status (id, name, created_at, updated_at) FROM stdin;
\.
COPY public.status (id, name, created_at, updated_at) FROM '$$PATH$$/4530.dat';

--
-- Data for Name: sub_districts; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.sub_districts (id, district_id, name, type, created_at, updated_at) FROM stdin;
\.
COPY public.sub_districts (id, district_id, name, type, created_at, updated_at) FROM '$$PATH$$/4531.dat';

--
-- Data for Name: user_roles; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.user_roles (id, name, code, "desc", created_at, updated_at) FROM stdin;
\.
COPY public.user_roles (id, name, code, "desc", created_at, updated_at) FROM '$$PATH$$/4532.dat';

--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users (id, urole_id, username, email, password, fullname, shortname, avatar, gender, age, phone, status, email_verified_at, remember_token, created_at, updated_at) FROM stdin;
\.
COPY public.users (id, urole_id, username, email, password, fullname, shortname, avatar, gender, age, phone, status, email_verified_at, remember_token, created_at, updated_at) FROM '$$PATH$$/4533.dat';

--
-- Data for Name: report_list; Type: TABLE DATA; Schema: report; Owner: postgres
--

COPY report.report_list (id, user_id, status_id, no_ticket, maintenance_by, created_at, updated_at) FROM stdin;
\.
COPY report.report_list (id, user_id, status_id, no_ticket, maintenance_by, created_at, updated_at) FROM '$$PATH$$/4534.dat';

--
-- Data for Name: report_photo; Type: TABLE DATA; Schema: report; Owner: postgres
--

COPY report.report_photo (id, report_segment_id, upload_dump_id, created_at, updated_at) FROM stdin;
\.
COPY report.report_photo (id, report_segment_id, upload_dump_id, created_at, updated_at) FROM '$$PATH$$/4535.dat';

--
-- Data for Name: report_segment; Type: TABLE DATA; Schema: report; Owner: postgres
--

COPY report.report_segment (id, report_id, segment_id, level, type, rate, comment, note, created_at, updated_at) FROM stdin;
\.
COPY report.report_segment (id, report_id, segment_id, level, type, rate, comment, note, created_at, updated_at) FROM '$$PATH$$/4536.dat';

--
-- Data for Name: status; Type: TABLE DATA; Schema: report; Owner: postgres
--

COPY report.status (id, name, created_at, updated_at) FROM stdin;
\.
COPY report.status (id, name, created_at, updated_at) FROM '$$PATH$$/4537.dat';

--
-- Data for Name: password_reset_tokens; Type: TABLE DATA; Schema: user; Owner: postgres
--

COPY "user".password_reset_tokens (email, token, created_at) FROM stdin;
\.
COPY "user".password_reset_tokens (email, token, created_at) FROM '$$PATH$$/4538.dat';

--
-- Data for Name: user_roles; Type: TABLE DATA; Schema: user; Owner: postgres
--

COPY "user".user_roles (id, name, code, "desc", created_at, updated_at) FROM stdin;
\.
COPY "user".user_roles (id, name, code, "desc", created_at, updated_at) FROM '$$PATH$$/4539.dat';

--
-- Data for Name: users; Type: TABLE DATA; Schema: user; Owner: postgres
--

COPY "user".users (id, urole_id, username, email, password, fullname, avatar, created_at, updated_at, email_verified_at, phone) FROM stdin;
\.
COPY "user".users (id, urole_id, username, email, password, fullname, avatar, created_at, updated_at, email_verified_at, phone) FROM '$$PATH$$/4540.dat';

--
-- Name: failed_jobs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.failed_jobs_id_seq', 1, false);


--
-- Name: master_irrigations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.master_irrigations_id_seq', 837, true);


--
-- Name: master_sub_district_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.master_sub_district_id_seq', 25, true);


--
-- Name: migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.migrations_id_seq', 13, true);


--
-- Name: personal_access_tokens_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.personal_access_tokens_id_seq', 1, false);


--
-- Name: article article_pkey; Type: CONSTRAINT; Schema: content; Owner: postgres
--

ALTER TABLE ONLY content.article
    ADD CONSTRAINT article_pkey PRIMARY KEY (id);


--
-- Name: upload_dump upload_dump_pkey; Type: CONSTRAINT; Schema: file; Owner: postgres
--

ALTER TABLE ONLY file.upload_dump
    ADD CONSTRAINT upload_dump_pkey PRIMARY KEY (id);


--
-- Name: city city_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.city
    ADD CONSTRAINT city_pkey PRIMARY KEY (id);


--
-- Name: district district_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.district
    ADD CONSTRAINT district_pkey PRIMARY KEY (id);


--
-- Name: irrigations irrigations_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations
    ADD CONSTRAINT irrigations_pkey PRIMARY KEY (id);


--
-- Name: irrigations_section irrigations_section_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations_section
    ADD CONSTRAINT irrigations_section_pkey PRIMARY KEY (id);


--
-- Name: irrigations_segment irrigations_segmen_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations_segment
    ADD CONSTRAINT irrigations_segmen_pkey PRIMARY KEY (id);


--
-- Name: sub_district sub_district_pkey; Type: CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.sub_district
    ADD CONSTRAINT sub_district_pkey PRIMARY KEY (id);


--
-- Name: city city_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.city
    ADD CONSTRAINT city_pkey PRIMARY KEY (id);


--
-- Name: districts districts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.districts
    ADD CONSTRAINT districts_pkey PRIMARY KEY (id);


--
-- Name: dss_analytic_data dss_analytic_data_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.dss_analytic_data
    ADD CONSTRAINT dss_analytic_data_pkey PRIMARY KEY (id);


--
-- Name: failed_jobs failed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.failed_jobs
    ADD CONSTRAINT failed_jobs_pkey PRIMARY KEY (id);


--
-- Name: failed_jobs failed_jobs_uuid_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.failed_jobs
    ADD CONSTRAINT failed_jobs_uuid_unique UNIQUE (uuid);


--
-- Name: irrigations irrigations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.irrigations
    ADD CONSTRAINT irrigations_pkey PRIMARY KEY (id);


--
-- Name: master_irrigations master_irrigations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.master_irrigations
    ADD CONSTRAINT master_irrigations_pkey PRIMARY KEY (id);


--
-- Name: master_sub_district master_sub_district_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.master_sub_district
    ADD CONSTRAINT master_sub_district_pkey PRIMARY KEY (id);


--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.migrations
    ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);


--
-- Name: password_reset_tokens password_reset_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.password_reset_tokens
    ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (email);


--
-- Name: personal_access_tokens personal_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_pkey PRIMARY KEY (id);


--
-- Name: personal_access_tokens personal_access_tokens_token_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.personal_access_tokens
    ADD CONSTRAINT personal_access_tokens_token_unique UNIQUE (token);


--
-- Name: report_list report_list_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_list
    ADD CONSTRAINT report_list_pkey PRIMARY KEY (id);


--
-- Name: status status_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.status
    ADD CONSTRAINT status_pkey PRIMARY KEY (id);


--
-- Name: sub_districts sub_districts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.sub_districts
    ADD CONSTRAINT sub_districts_pkey PRIMARY KEY (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 (id);


--
-- Name: users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_email_unique UNIQUE (email);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: users users_username_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_username_unique UNIQUE (username);


--
-- Name: report_list report_list_pkey; Type: CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_list
    ADD CONSTRAINT report_list_pkey PRIMARY KEY (id);


--
-- Name: report_photo report_photo_pkey; Type: CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_photo
    ADD CONSTRAINT report_photo_pkey PRIMARY KEY (id);


--
-- Name: report_segment report_segment_pkey; Type: CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_segment
    ADD CONSTRAINT report_segment_pkey PRIMARY KEY (id);


--
-- Name: status status_pkey; Type: CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.status
    ADD CONSTRAINT status_pkey PRIMARY KEY (id);


--
-- Name: password_reset_tokens password_reset_tokens_pkey; Type: CONSTRAINT; Schema: user; Owner: postgres
--

ALTER TABLE ONLY "user".password_reset_tokens
    ADD CONSTRAINT password_reset_tokens_pkey PRIMARY KEY (email);


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

ALTER TABLE ONLY "user".user_roles
    ADD CONSTRAINT user_roles_pkey PRIMARY KEY (id);


--
-- Name: users users_email_unique; Type: CONSTRAINT; Schema: user; Owner: postgres
--

ALTER TABLE ONLY "user".users
    ADD CONSTRAINT users_email_unique UNIQUE (email);


--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: user; Owner: postgres
--

ALTER TABLE ONLY "user".users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- Name: users users_username_unique; Type: CONSTRAINT; Schema: user; Owner: postgres
--

ALTER TABLE ONLY "user".users
    ADD CONSTRAINT users_username_unique UNIQUE (username);


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

CREATE INDEX personal_access_tokens_tokenable_type_tokenable_id_index ON public.personal_access_tokens USING btree (tokenable_type, tokenable_id);


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

CREATE INDEX sidx_master_irrigations_geom ON public.master_irrigations USING gist (geom);


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

CREATE INDEX sidx_master_sub_district_geom ON public.master_sub_district USING gist (geom);


--
-- Name: district district_city_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.district
    ADD CONSTRAINT district_city_id_fkey FOREIGN KEY (city_id) REFERENCES map.city(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: irrigations irrigations_district_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations
    ADD CONSTRAINT irrigations_district_id_fkey FOREIGN KEY (district_id) REFERENCES map.district(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: irrigations_section irrigations_section_irrigation_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations_section
    ADD CONSTRAINT irrigations_section_irrigation_id_fkey FOREIGN KEY (irrigation_id) REFERENCES map.irrigations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: irrigations_segment irrigations_segmen_irrigation_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations_segment
    ADD CONSTRAINT irrigations_segmen_irrigation_id_fkey FOREIGN KEY (irrigation_id) REFERENCES map.irrigations(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: irrigations_segment irrigations_segmen_irrigation_section_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations_segment
    ADD CONSTRAINT irrigations_segmen_irrigation_section_id_fkey FOREIGN KEY (irrigation_section_id) REFERENCES map.irrigations_section(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: irrigations irrigations_sub_district_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.irrigations
    ADD CONSTRAINT irrigations_sub_district_id_fkey FOREIGN KEY (sub_district_id) REFERENCES map.sub_district(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sub_district sub_district_city_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.sub_district
    ADD CONSTRAINT sub_district_city_id_fkey FOREIGN KEY (city_id) REFERENCES map.city(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sub_district sub_district_district_id_fkey; Type: FK CONSTRAINT; Schema: map; Owner: postgres
--

ALTER TABLE ONLY map.sub_district
    ADD CONSTRAINT sub_district_district_id_fkey FOREIGN KEY (district_id) REFERENCES map.district(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: districts districts_city_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.districts
    ADD CONSTRAINT districts_city_id_foreign FOREIGN KEY (city_id) REFERENCES public.city(id);


--
-- Name: dss_analytic_data dss_analytic_data_report_list_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.dss_analytic_data
    ADD CONSTRAINT dss_analytic_data_report_list_id_foreign FOREIGN KEY (report_list_id) REFERENCES public.report_list(id);


--
-- Name: irrigations irrigations_district_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.irrigations
    ADD CONSTRAINT irrigations_district_id_foreign FOREIGN KEY (district_id) REFERENCES public.districts(id);


--
-- Name: irrigations irrigations_sub_district_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.irrigations
    ADD CONSTRAINT irrigations_sub_district_id_foreign FOREIGN KEY (sub_district_id) REFERENCES public.sub_districts(id);


--
-- Name: report_list report_list_status_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_list
    ADD CONSTRAINT report_list_status_id_foreign FOREIGN KEY (status_id) REFERENCES public.status(id);


--
-- Name: report_list report_list_user_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_list
    ADD CONSTRAINT report_list_user_id_foreign FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: sub_districts sub_districts_district_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.sub_districts
    ADD CONSTRAINT sub_districts_district_id_foreign FOREIGN KEY (district_id) REFERENCES public.districts(id);


--
-- Name: users users_urole_id_foreign; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.users
    ADD CONSTRAINT users_urole_id_foreign FOREIGN KEY (urole_id) REFERENCES public.user_roles(id);


--
-- Name: report_list report_list_status_id_foreign; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_list
    ADD CONSTRAINT report_list_status_id_foreign FOREIGN KEY (status_id) REFERENCES report.status(id);


--
-- Name: report_list report_list_user_id_foreign; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_list
    ADD CONSTRAINT report_list_user_id_foreign FOREIGN KEY (user_id) REFERENCES "user".users(id);


--
-- Name: report_photo report_photo_report_segment_id_fkey; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_photo
    ADD CONSTRAINT report_photo_report_segment_id_fkey FOREIGN KEY (report_segment_id) REFERENCES report.report_segment(id);


--
-- Name: report_photo report_photo_upload_dump_id_fkey; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_photo
    ADD CONSTRAINT report_photo_upload_dump_id_fkey FOREIGN KEY (upload_dump_id) REFERENCES file.upload_dump(id);


--
-- Name: report_segment report_segment_report_id_fkey; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_segment
    ADD CONSTRAINT report_segment_report_id_fkey FOREIGN KEY (report_id) REFERENCES report.report_list(id);


--
-- Name: report_segment report_segment_segment_id_fkey; Type: FK CONSTRAINT; Schema: report; Owner: postgres
--

ALTER TABLE ONLY report.report_segment
    ADD CONSTRAINT report_segment_segment_id_fkey FOREIGN KEY (segment_id) REFERENCES map.irrigations_segment(id);


--
-- Name: users users_urole_id_foreign; Type: FK CONSTRAINT; Schema: user; Owner: postgres
--

ALTER TABLE ONLY "user".users
    ADD CONSTRAINT users_urole_id_foreign FOREIGN KEY (urole_id) REFERENCES "user".user_roles(id);


--
-- PostgreSQL database dump complete
--

