--
-- PostgreSQL database dump
--

-- Dumped from database version 10.5
-- Dumped by pg_dump version 10.5

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 client_min_messages = warning;
SET row_security = off;

--
-- Name: DATABASE "Cviceni"; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON DATABASE "Cviceni" IS 'Datab�ze obsahuj�c� �daje p��slu�n� k 3d cvi�ebn�mu stroji';


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

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


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

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET default_tablespace = '';

SET default_with_oids = false;

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

CREATE TABLE public.indications (
    ind_id integer NOT NULL,
    indication text,
    description text,
    curve_name text,
    procedure_time integer
);


ALTER TABLE public.indications OWNER TO postgres;

--
-- Name: TABLE indications; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.indications IS 'Indikace pacientů';


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

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


ALTER TABLE public."Indications_Ind_id_seq" OWNER TO postgres;

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

ALTER SEQUENCE public."Indications_Ind_id_seq" OWNED BY public.indications.ind_id;


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

CREATE TABLE public.actual_indication (
    id_p integer NOT NULL,
    id_ind integer NOT NULL
);


ALTER TABLE public.actual_indication OWNER TO postgres;

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

CREATE TABLE public.patient (
    id integer NOT NULL,
    name text,
    surname text NOT NULL,
    birthdate date NOT NULL,
    id_number text NOT NULL
);


ALTER TABLE public.patient OWNER TO postgres;

--
-- Name: TABLE patient; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.patient IS 'Seznam pacientů a příslušných údajů';


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

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


ALTER TABLE public.patient_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.patient_id_seq OWNED BY public.patient.id;


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

CREATE TABLE public.results (
    p_id integer NOT NULL,
    ind_id integer NOT NULL,
    cycles integer NOT NULL,
    result integer[],
    result_id integer NOT NULL
);


ALTER TABLE public.results OWNER TO postgres;

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

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


ALTER TABLE public.results_result_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.results_result_id_seq OWNED BY public.results.result_id;


--
-- Name: indications ind_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.indications ALTER COLUMN ind_id SET DEFAULT nextval('public."Indications_Ind_id_seq"'::regclass);


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

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


--
-- Name: results result_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.results ALTER COLUMN result_id SET DEFAULT nextval('public.results_result_id_seq'::regclass);


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

COPY public.actual_indication (id_p, id_ind) FROM stdin;
\.


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

COPY public.indications (ind_id, indication, description, curve_name, procedure_time) FROM stdin;
\.


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

COPY public.patient (id, name, surname, birthdate, id_number) FROM stdin;
\.


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

COPY public.results (p_id, ind_id, cycles, result, result_id) FROM stdin;
\.


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

SELECT pg_catalog.setval('public."Indications_Ind_id_seq"', 5, true);


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

SELECT pg_catalog.setval('public.patient_id_seq', 9, true);


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

SELECT pg_catalog.setval('public.results_result_id_seq', 7, true);


--
-- Name: patient id_num; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.patient
    ADD CONSTRAINT id_num UNIQUE (id_number);


--
-- Name: indications indication_name; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.indications
    ADD CONSTRAINT indication_name UNIQUE (indication);


--
-- Name: indications indications_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.indications
    ADD CONSTRAINT indications_pkey PRIMARY KEY (ind_id);


--
-- Name: patient patient_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.patient
    ADD CONSTRAINT patient_pkey PRIMARY KEY (id);


--
-- Name: results results_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.results
    ADD CONSTRAINT results_pkey PRIMARY KEY (result_id);


--
-- Name: actual_indication id_ind; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.actual_indication
    ADD CONSTRAINT id_ind FOREIGN KEY (id_p) REFERENCES public.indications(ind_id);


--
-- Name: actual_indication id_p; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.actual_indication
    ADD CONSTRAINT id_p FOREIGN KEY (id_p) REFERENCES public.patient(id);


--
-- Name: results indication; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.results
    ADD CONSTRAINT indication FOREIGN KEY (p_id) REFERENCES public.indications(ind_id);


--
-- Name: results patient; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.results
    ADD CONSTRAINT patient FOREIGN KEY (p_id) REFERENCES public.patient(id);


--
-- PostgreSQL database dump complete
--

