--
-- PostgreSQL database dump
--

-- Dumped from database version 14.1 (Debian 14.1-1.pgdg110+1)
-- Dumped by pg_dump version 14.1

-- Started on 2022-02-04 18:04:55

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;

--
-- TOC entry 3 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA public;


--
-- TOC entry 3345 (class 0 OID 0)
-- Dependencies: 3
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON SCHEMA public IS 'standard public schema';


SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 210 (class 1259 OID 16385)
-- Name: developers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.developers (
    id integer NOT NULL,
    name character varying NOT NULL,
    email character varying NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    group_id integer,
    cv jsonb
);


--
-- TOC entry 209 (class 1259 OID 16384)
-- Name: developer_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.developers ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.developer_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- TOC entry 212 (class 1259 OID 16394)
-- Name: groups; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.groups (
    id integer NOT NULL,
    name character varying NOT NULL,
    leader_id integer NOT NULL
);


--
-- TOC entry 211 (class 1259 OID 16393)
-- Name: group_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.groups ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.group_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- TOC entry 215 (class 1259 OID 16429)
-- Name: lang_to_developers; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.lang_to_developers (
    language_id integer NOT NULL,
    developer_id integer NOT NULL
);


--
-- TOC entry 214 (class 1259 OID 16422)
-- Name: languages; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.languages (
    id integer NOT NULL,
    name character varying NOT NULL,
    shortname character varying
);


--
-- TOC entry 213 (class 1259 OID 16421)
-- Name: languages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

ALTER TABLE public.languages ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.languages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- TOC entry 3334 (class 0 OID 16385)
-- Dependencies: 210
-- Data for Name: developers; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO public.developers VALUES (4, 'Qadir', 'qadir@sendel.ru', true, NULL, '{"companies": [{"name": "itDEW", "startDate": "2017-02-11"}]}');
INSERT INTO public.developers VALUES (11, 'Boris', 'boris@sendel.ru', true, NULL, NULL);
INSERT INTO public.developers VALUES (2, 'Ivan', 'ivan@sendel.ru', true, 1, '{"companies": [{"name": "itDEW", "startDate": "2019-02-01"}]}');
INSERT INTO public.developers VALUES (3, 'Victor', 'victor@sendel.ru', true, 1, '{"companies": [{"name": "solanas", "startDate": "2016-02-11"}]}');
INSERT INTO public.developers VALUES (5, 'Rajesh', 'rajesh@sendel.ru', true, 4, '{"companies": [{"name": "Guargon", "startDate": "2016-02-11"}]}');
INSERT INTO public.developers VALUES (6, 'Konstantin', 'konstantin@sendel.ru', true, 4, '{"companies": [{"name": "GRAO", "startDate": "2011-05-10"}]}');
INSERT INTO public.developers VALUES (10, 'Nikita', 'nikita@sendel.ru', true, 3, NULL);


--
-- TOC entry 3336 (class 0 OID 16394)
-- Dependencies: 212
-- Data for Name: groups; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO public.groups VALUES (1, 'Fintech', 2);
INSERT INTO public.groups VALUES (3, 'Telecom', 10);
INSERT INTO public.groups VALUES (4, 'Logistic', 11);


--
-- TOC entry 3339 (class 0 OID 16429)
-- Dependencies: 215
-- Data for Name: lang_to_developers; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO public.lang_to_developers VALUES (1, 6);
INSERT INTO public.lang_to_developers VALUES (1, 3);
INSERT INTO public.lang_to_developers VALUES (2, 6);
INSERT INTO public.lang_to_developers VALUES (3, 6);
INSERT INTO public.lang_to_developers VALUES (1, 10);
INSERT INTO public.lang_to_developers VALUES (1, 11);
INSERT INTO public.lang_to_developers VALUES (2, 5);
INSERT INTO public.lang_to_developers VALUES (5, 5);
INSERT INTO public.lang_to_developers VALUES (8, 2);
INSERT INTO public.lang_to_developers VALUES (10, 4);
INSERT INTO public.lang_to_developers VALUES (5, 4);
INSERT INTO public.lang_to_developers VALUES (7, 3);
INSERT INTO public.lang_to_developers VALUES (6, 3);


--
-- TOC entry 3338 (class 0 OID 16422)
-- Dependencies: 214
-- Data for Name: languages; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO public.languages VALUES (1, 'Java', NULL);
INSERT INTO public.languages VALUES (2, 'JavaScript', 'js');
INSERT INTO public.languages VALUES (3, 'Python', 'py');
INSERT INTO public.languages VALUES (4, 'Kotlin', 'kt');
INSERT INTO public.languages VALUES (5, 'C#', NULL);
INSERT INTO public.languages VALUES (6, 'C', NULL);
INSERT INTO public.languages VALUES (7, 'C++', NULL);
INSERT INTO public.languages VALUES (8, 'R', NULL);
INSERT INTO public.languages VALUES (9, 'F', NULL);
INSERT INTO public.languages VALUES (10, 'GoLang', 'go');


--
-- TOC entry 3346 (class 0 OID 0)
-- Dependencies: 209
-- Name: developer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('public.developer_id_seq', 11, true);


--
-- TOC entry 3347 (class 0 OID 0)
-- Dependencies: 211
-- Name: group_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('public.group_id_seq', 4, true);


--
-- TOC entry 3348 (class 0 OID 0)
-- Dependencies: 213
-- Name: languages_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--

SELECT pg_catalog.setval('public.languages_id_seq', 10, true);


--
-- TOC entry 3183 (class 2606 OID 16389)
-- Name: developers developer_pk; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.developers
    ADD CONSTRAINT developer_pk PRIMARY KEY (id);


--
-- TOC entry 3185 (class 2606 OID 16415)
-- Name: groups group_pk; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.groups
    ADD CONSTRAINT group_pk PRIMARY KEY (id);


--
-- TOC entry 3189 (class 2606 OID 16433)
-- Name: lang_to_developers lang_and_developers_pk; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.lang_to_developers
    ADD CONSTRAINT lang_and_developers_pk PRIMARY KEY (language_id, developer_id);


--
-- TOC entry 3187 (class 2606 OID 16428)
-- Name: languages languages_pk; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.languages
    ADD CONSTRAINT languages_pk PRIMARY KEY (id);


--
-- TOC entry 3190 (class 2606 OID 16416)
-- Name: developers developer_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.developers
    ADD CONSTRAINT developer_fk FOREIGN KEY (group_id) REFERENCES public.groups(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- TOC entry 3192 (class 2606 OID 16434)
-- Name: lang_to_developers developer_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.lang_to_developers
    ADD CONSTRAINT developer_fk FOREIGN KEY (developer_id) REFERENCES public.developers(id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- TOC entry 3191 (class 2606 OID 16409)
-- Name: groups group_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.groups
    ADD CONSTRAINT group_fk FOREIGN KEY (leader_id) REFERENCES public.developers(id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- TOC entry 3193 (class 2606 OID 16439)
-- Name: lang_to_developers language_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.lang_to_developers
    ADD CONSTRAINT language_fk FOREIGN KEY (language_id) REFERENCES public.languages(id) ON UPDATE CASCADE ON DELETE RESTRICT;


-- Completed on 2022-02-04 18:04:56

--
-- PostgreSQL database dump complete
--

