--
-- PostgreSQL database dump
--

-- Dumped from database version 12.7
-- Dumped by pg_dump version 12.7

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;

SET default_tablespace = '';

SET default_table_access_method = heap;

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

CREATE TABLE public.resourse_log (
    id integer NOT NULL,
    resource_id integer NOT NULL,
    time_log_created timestamp with time zone NOT NULL,
    operation character(1) NOT NULL,
    user_id integer NOT NULL
);


ALTER TABLE public.resourse_log OWNER TO postgres;

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

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


ALTER TABLE public.resourse_log_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.resourse_log_id_seq OWNED BY public.resourse_log.id;


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

CREATE TABLE public.current_resourse (
    id integer NOT NULL,
    resource_id integer NOT NULL,
    user_id integer NOT NULL,
    order_status character(1),
    order_id character(1),
    current_token name NOT NULL,
    doors_output character(1) NOT NULL,
    engine_input character(1) NOT NULL,
    central_lock_input character(1) NOT NULL,
    ignition_input character(1) NOT NULL,
    doors_input character(1) NOT NULL,
    input4 name,
    controller_status character(1) NOT NULL,
    signal_gsm integer NOT NULL,
    operator_gsm name NOT NULL,
    signal_gps integer NOT NULL,
    location character varying(30),
    speed real NOT NULL,
    direction character(1) NOT NULL,
    address name NOT NULL,
    battery_level integer NOT NULL,
    board_voltage numeric(3,1) NOT NULL
);


ALTER TABLE public.current_resourse OWNER TO postgres;

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

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


ALTER TABLE public.current_resourse_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.current_resourse_id_seq OWNED BY public.current_resourse.id;


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

CREATE TABLE public.current_timetable (
    id integer NOT NULL,
    order_id integer NOT NULL,
    service_type_id integer NOT NULL,
    privider_id integer NOT NULL,
    resource_id integer NOT NULL,
    time_start_predicted timestamp with time zone,
    time_finished_predicted timestamp with time zone,
    gap integer
);


ALTER TABLE public.current_timetable OWNER TO postgres;

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

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


ALTER TABLE public.current_timetable_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.current_timetable_id_seq OWNED BY public.current_timetable.id;


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

CREATE TABLE public.order_list_log (
    id integer NOT NULL,
    payment_transaction_id integer NOT NULL,
    service_id integer NOT NULL,
    service_type_id integer NOT NULL,
    time_placed timestamp with time zone NOT NULL,
    time_start timestamp with time zone NOT NULL,
    time_finish_predicted timestamp with time zone,
    time_finish_real timestamp with time zone NOT NULL,
    order_place_start character varying(255) NOT NULL,
    order_place_predicted character varying(255) NOT NULL,
    order_place_real character varying(255) NOT NULL,
    price money NOT NULL,
    provider integer NOT NULL,
    receiver integer NOT NULL,
    client integer NOT NULL
);


ALTER TABLE public.order_list_log OWNER TO postgres;

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

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


ALTER TABLE public.order_list_log_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.order_list_log_id_seq OWNED BY public.order_list_log.id;


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

CREATE TABLE public.tickets (
    id integer NOT NULL,
    type character(1) NOT NULL,
    id_reporter integer NOT NULL,
    id_asignee integer,
    time_created timestamp with time zone NOT NULL,
    time_assigned timestamp with time zone,
    time_changed timestamp with time zone,
    time_closed timestamp with time zone,
    status character(1) NOT NULL,
    description text
);


ALTER TABLE public.tickets OWNER TO postgres;

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

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


ALTER TABLE public.tickets_id_seq OWNER TO postgres;

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

ALTER SEQUENCE public.tickets_id_seq OWNED BY public.tickets.id;


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

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


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

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


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

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


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

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


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

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


--
-- Name: resourse_log resourse_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.resourse_log
    ADD CONSTRAINT resourse_log_pkey PRIMARY KEY (id);


--
-- Name: current_resourse current_resourse_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.current_resourse
    ADD CONSTRAINT current_resourse_pkey PRIMARY KEY (id);


--
-- Name: current_timetable current_timetable_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.current_timetable
    ADD CONSTRAINT current_timetable_pkey PRIMARY KEY (id);


--
-- Name: order_list_log order_list_log_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.order_list_log
    ADD CONSTRAINT order_list_log_pkey PRIMARY KEY (id);


--
-- Name: tickets tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tickets
    ADD CONSTRAINT tickets_pkey PRIMARY KEY (id);


--
-- PostgreSQL database dump complete
--

