--
-- PostgreSQL database dump
--

\restrict ijnV8LNUvXkT7zfNUtK8rYjTPMZ7E4a8Dp7BES0I4ggucAotiMgPl90yvhq0XQq

-- Dumped from database version 18.3 (Debian 18.3-1.pgdg13+1)
-- Dumped by pg_dump version 18.3 (Debian 18.3-1.pgdg13+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_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: settings; Type: TABLE; Schema: public; Owner: eco
--

CREATE TABLE public.settings (
    id integer NOT NULL,
    key character varying(50),
    value character varying(100)
);


ALTER TABLE public.settings OWNER TO eco;

--
-- Name: settings_id_seq; Type: SEQUENCE; Schema: public; Owner: eco
--

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


ALTER SEQUENCE public.settings_id_seq OWNER TO eco;

--
-- Name: settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: eco
--

ALTER SEQUENCE public.settings_id_seq OWNED BY public.settings.id;


--
-- Name: system_status; Type: TABLE; Schema: public; Owner: eco
--

CREATE TABLE public.system_status (
    id integer NOT NULL,
    device_name character varying(50),
    online boolean,
    last_seen timestamp without time zone
);


ALTER TABLE public.system_status OWNER TO eco;

--
-- Name: system_status_id_seq; Type: SEQUENCE; Schema: public; Owner: eco
--

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


ALTER SEQUENCE public.system_status_id_seq OWNER TO eco;

--
-- Name: system_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: eco
--

ALTER SEQUENCE public.system_status_id_seq OWNED BY public.system_status.id;


--
-- Name: telemetry; Type: TABLE; Schema: public; Owner: eco
--

CREATE TABLE public.telemetry (
    id integer NOT NULL,
    "timestamp" timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    upv double precision,
    ipv double precision,
    ubat double precision,
    ibat double precision,
    power double precision,
    temperature double precision,
    luminosity double precision,
    humidity double precision
);


ALTER TABLE public.telemetry OWNER TO eco;

--
-- Name: telemetry_id_seq; Type: SEQUENCE; Schema: public; Owner: eco
--

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


ALTER SEQUENCE public.telemetry_id_seq OWNER TO eco;

--
-- Name: telemetry_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: eco
--

ALTER SEQUENCE public.telemetry_id_seq OWNED BY public.telemetry.id;


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

CREATE TABLE public.users (
    id integer NOT NULL,
    username character varying(50),
    password character varying(255),
    is_admin boolean DEFAULT false
);


ALTER TABLE public.users OWNER TO eco;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: eco
--

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


ALTER SEQUENCE public.users_id_seq OWNER TO eco;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: eco
--

ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;


--
-- Name: settings id; Type: DEFAULT; Schema: public; Owner: eco
--

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


--
-- Name: system_status id; Type: DEFAULT; Schema: public; Owner: eco
--

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


--
-- Name: telemetry id; Type: DEFAULT; Schema: public; Owner: eco
--

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


--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: eco
--

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


--
-- Data for Name: settings; Type: TABLE DATA; Schema: public; Owner: eco
--

COPY public.settings (id, key, value) FROM stdin;
1	temp_max	60
2	battery_min	11
3	solar_max	22
\.


--
-- Data for Name: system_status; Type: TABLE DATA; Schema: public; Owner: eco
--

COPY public.system_status (id, device_name, online, last_seen) FROM stdin;
1	esp32	f	2026-03-05 15:07:28.827398
\.


--
-- Data for Name: telemetry; Type: TABLE DATA; Schema: public; Owner: eco
--

COPY public.telemetry (id, "timestamp", upv, ipv, ubat, ibat, power, temperature, luminosity, humidity) FROM stdin;
1	2026-03-05 14:51:17.119119	18.5	0.7	12.4	0.5	13	32	500	45
2	2026-03-05 15:07:19.878569	19	0.8	12.5	0.5	14	31	600	40
\.


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

COPY public.users (id, username, password, is_admin) FROM stdin;
1	admin	admin123	t
\.


--
-- Name: settings_id_seq; Type: SEQUENCE SET; Schema: public; Owner: eco
--

SELECT pg_catalog.setval('public.settings_id_seq', 3, true);


--
-- Name: system_status_id_seq; Type: SEQUENCE SET; Schema: public; Owner: eco
--

SELECT pg_catalog.setval('public.system_status_id_seq', 1, true);


--
-- Name: telemetry_id_seq; Type: SEQUENCE SET; Schema: public; Owner: eco
--

SELECT pg_catalog.setval('public.telemetry_id_seq', 2, true);


--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: eco
--

SELECT pg_catalog.setval('public.users_id_seq', 1, true);


--
-- Name: settings settings_key_key; Type: CONSTRAINT; Schema: public; Owner: eco
--

ALTER TABLE ONLY public.settings
    ADD CONSTRAINT settings_key_key UNIQUE (key);


--
-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: eco
--

ALTER TABLE ONLY public.settings
    ADD CONSTRAINT settings_pkey PRIMARY KEY (id);


--
-- Name: system_status system_status_pkey; Type: CONSTRAINT; Schema: public; Owner: eco
--

ALTER TABLE ONLY public.system_status
    ADD CONSTRAINT system_status_pkey PRIMARY KEY (id);


--
-- Name: telemetry telemetry_pkey; Type: CONSTRAINT; Schema: public; Owner: eco
--

ALTER TABLE ONLY public.telemetry
    ADD CONSTRAINT telemetry_pkey PRIMARY KEY (id);


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

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


--
-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: eco
--

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


--
-- PostgreSQL database dump complete
--

\unrestrict ijnV8LNUvXkT7zfNUtK8rYjTPMZ7E4a8Dp7BES0I4ggucAotiMgPl90yvhq0XQq

