--
-- PostgreSQL database dump
--

-- Dumped from database version 16.8 (Ubuntu 16.8-0ubuntu0.24.04.1)
-- Dumped by pg_dump version 16.8 (Ubuntu 16.8-0ubuntu0.24.04.1)

-- Started on 2025-04-13 11:04:16 CEST

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;

--
-- TOC entry 223 (class 1259 OID 16527)
-- Name: categories; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.categories (
    id integer NOT NULL,
    name text NOT NULL
);


ALTER TABLE public.categories OWNER TO postgres;

--
-- TOC entry 222 (class 1259 OID 16526)
-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER SEQUENCE public.categories_id_seq OWNER TO postgres;

--
-- TOC entry 3502 (class 0 OID 0)
-- Dependencies: 222
-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;


--
-- TOC entry 225 (class 1259 OID 16573)
-- Name: deletion_requests; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.deletion_requests (
    id integer NOT NULL,
    object_id integer NOT NULL,
    requested_by integer NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    status character varying(20) DEFAULT 'pending'::character varying
);


ALTER TABLE public.deletion_requests OWNER TO postgres;

--
-- TOC entry 224 (class 1259 OID 16572)
-- Name: deletion_requests_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER SEQUENCE public.deletion_requests_id_seq OWNER TO postgres;

--
-- TOC entry 3503 (class 0 OID 0)
-- Dependencies: 224
-- Name: deletion_requests_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.deletion_requests_id_seq OWNED BY public.deletion_requests.id;


--
-- TOC entry 215 (class 1259 OID 16468)
-- Name: range_data; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.range_data (
    station_id integer NOT NULL,
    temperature_min numeric,
    temperature_max numeric,
    pressure_min numeric,
    pressure_max numeric,
    humidity_min numeric,
    humidity_max numeric
);


ALTER TABLE public.range_data OWNER TO postgres;

--
-- TOC entry 219 (class 1259 OID 16502)
-- Name: users; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.users (
    id integer NOT NULL,
    name character varying(50) NOT NULL,
    surname character varying(50) NOT NULL,
    email character varying(100) NOT NULL,
    gender character varying(10) NOT NULL,
    password text NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    points integer DEFAULT 0,
    CONSTRAINT users_gender_check CHECK (((gender)::text = ANY ((ARRAY['homme'::character varying, 'femme'::character varying])::text[])))
);


ALTER TABLE public.users OWNER TO postgres;

--
-- TOC entry 218 (class 1259 OID 16501)
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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 postgres;

--
-- TOC entry 3504 (class 0 OID 0)
-- Dependencies: 218
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

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


--
-- TOC entry 221 (class 1259 OID 16524)
-- Name: weather_data_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER SEQUENCE public.weather_data_id_seq OWNER TO postgres;

--
-- TOC entry 216 (class 1259 OID 16473)
-- Name: weather_data; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.weather_data (
    id integer DEFAULT nextval('public.weather_data_id_seq'::regclass) NOT NULL,
    station_id integer NOT NULL,
    temperature numeric(5,2),
    humidity numeric(5,2),
    pressure numeric(7,2),
    wind_speed numeric(5,2),
    wind_direction character varying(50),
    "timestamp" timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.weather_data OWNER TO postgres;

--
-- TOC entry 220 (class 1259 OID 16522)
-- Name: weather_objects_id_seq1; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER SEQUENCE public.weather_objects_id_seq1 OWNER TO postgres;

--
-- TOC entry 217 (class 1259 OID 16477)
-- Name: weather_objects; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.weather_objects (
    id integer DEFAULT nextval('public.weather_objects_id_seq1'::regclass) NOT NULL,
    name character varying(500) NOT NULL,
    description text,
    type character varying(100) NOT NULL,
    location character varying(255),
    last_update timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    status character varying(50) DEFAULT 'active'::character varying,
    batterie integer,
    type_batterie character varying(50),
    proprio_id integer,
    CONSTRAINT weather_objects_batterie_check CHECK (((batterie >= 0) AND (batterie <= 100)))
);


ALTER TABLE public.weather_objects OWNER TO postgres;

--
-- TOC entry 3317 (class 2604 OID 16530)
-- Name: categories id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3318 (class 2604 OID 16576)
-- Name: deletion_requests id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3314 (class 2604 OID 16505)
-- Name: users id; Type: DEFAULT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3494 (class 0 OID 16527)
-- Dependencies: 223
-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.categories (id, name) FROM stdin;
1	Station météo
2	Capteur
3	Passerelle
4	Anémomètre
5	Pluviomètre
6	Thermomètre
7	Hygromètre
\.


--
-- TOC entry 3496 (class 0 OID 16573)
-- Dependencies: 225
-- Data for Name: deletion_requests; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.deletion_requests (id, object_id, requested_by, created_at, status) FROM stdin;
1	2	1	2025-04-13 10:45:55.942399	pending
\.


--
-- TOC entry 3486 (class 0 OID 16468)
-- Dependencies: 215
-- Data for Name: range_data; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.range_data (station_id, temperature_min, temperature_max, pressure_min, pressure_max, humidity_min, humidity_max) FROM stdin;
1	-33	42	980	1040	30	84
2	-15	50	980	1040	30	90
3	-15	50	980	1040	30	90
4	-15	50	980	1040	30	90
5	-15	50	980	1040	30	90
6	-15	50	980	1040	30	90
7	-15	50	980	1040	30	90
8	-15	50	980	1040	30	90
9	-15	50	980	1040	30	90
10	-15	50	980	1040	30	90
\.


--
-- TOC entry 3490 (class 0 OID 16502)
-- Dependencies: 219
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.users (id, name, surname, email, gender, password, created_at, points) FROM stdin;
1	Jean	Dupont	jean.dupont@example.com	homme	hashed_password1	2025-03-31 15:15:17.203076	0
2	Marie	Curie	marie.curie@example.com	femme	hashed_password2	2025-03-31 15:15:17.203076	0
3	Albert	Einstein	albert.einstein@example.com	homme	hashed_password3	2025-03-31 15:15:17.203076	0
4	Alice	Lemoine	alice@example.com	femme	$2a$12$QNx7sC7VBXrU7QHFhU78vunLIU3C9KiVT2KyCJ5y6G0cdJB/k0YuC	2025-03-31 16:59:25.687126	0
15	azaz	azeazae	azeaze@azeaze	femme	$2a$12$YPEoDDRD/y2Zxh7mfTUWHuCgT9k3OlqwGWBPNpPx2yTSlfY4yHSka	2025-03-31 17:26:18.258471	0
16	El moudden	Nassef	nassmaghrebi@gmail.com	homme	$2a$12$f6Ovl48RsbipNNsEBcVjP.DGdCYPaxlHsZ2YexpeHDAXq4UzMK3hm	2025-04-01 15:34:05.987387	0
17	Declos	Mathis	md10022004@gmail.com	homme	$2a$12$/PufX/T..YU1Ze3yNYAkU.Ql8VqaBP7vmNXBK1Q8NniEA/Vqi37Qa	2025-04-02 11:12:36.427383	0
19	azeaze	azeaze	azeaze@aeaze.com	femme	$2a$12$vH.MxhvC/cJ02SNZSsr9SeHYy.JWoIFLKZGKVhUHLv7b9E1rm3Dam	2025-04-04 10:40:01.71072	0
20	Mendiburu	Charles	charles@gmail.com	homme	$2a$12$RPL.17dQ66kyZyfCST2EYePeDd/4iNhpr7hCpfBxJ7cROt/Lx1/zK	2025-04-11 19:06:41.216647	104
18	Mendiburu	Charles	charles.mendi1609@gmail.com	homme	$2a$12$PLowdJvo.jsnzbjE9CEccucGPE5XDn9kyn2nmyWWvh8eydT4827CS	2025-04-04 08:51:44.689425	226
\.


--
-- TOC entry 3487 (class 0 OID 16473)
-- Dependencies: 216
-- Data for Name: weather_data; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.weather_data (id, station_id, temperature, humidity, pressure, wind_speed, wind_direction, "timestamp") FROM stdin;
1	1	21.50	60.20	1013.10	5.40	Nord-Ouest	2025-03-29 18:47:46.685241
2	2	22.30	55.00	1012.50	3.20	Sud-Ouest	2025-03-29 18:47:46.685241
3	3	24.10	50.00	1010.80	6.00	Est	2025-03-29 18:47:46.685241
4	1	22.50	65.40	1013.20	5.50	Nord-Ouest	2025-04-12 01:33:17.747529
5	2	19.30	70.10	1012.80	4.70	Sud-Est	2025-04-12 01:33:17.747529
6	2	22.50	65.40	1013.20	5.50	Nord-Ouest	2025-04-12 01:34:04.077375
7	3	19.30	70.10	1012.80	4.70	Sud-Est	2025-04-12 01:34:04.077375
\.


--
-- TOC entry 3488 (class 0 OID 16477)
-- Dependencies: 217
-- Data for Name: weather_objects; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.weather_objects (id, name, description, type, location, last_update, status, batterie, type_batterie, proprio_id) FROM stdin;
2	Station Lyon	Station météo située à Lyon, France.	station	Lyon, France	2025-03-30 12:16:00.835834	active	100	solaire	\N
4	Station Alpha	Station météo dans le centre-ville	station_meteo	Paris	2025-04-12 01:32:19.680121	active	80	Li-Ion	1
5	Station Beta	Station météo sur la montagne	station_meteo	Alpes	2025-04-12 01:32:19.680121	active	60	NiMH	2
6	Station Gamma	Station météo près de la mer	station_meteo	Nice	2025-04-12 01:32:19.680121	active	90	Li-Ion	3
1	Station Paris	Station météo située à Paris, France.	station	Paris, France	2025-04-12 01:36:03.306108	inactive	100	solaire	\N
3	Station Marseille	Station météo située à Marseille, France.	station	Marseille, France	2025-04-12 01:36:32.314423	active	100	solaire	\N
7	Station Meteo Charles	Station meteo de charles	station meteo	Capbreton	2025-04-12 09:29:48.565373	active	\N	Solaire	18
\.


--
-- TOC entry 3505 (class 0 OID 0)
-- Dependencies: 222
-- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3506 (class 0 OID 0)
-- Dependencies: 224
-- Name: deletion_requests_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3507 (class 0 OID 0)
-- Dependencies: 218
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3508 (class 0 OID 0)
-- Dependencies: 221
-- Name: weather_data_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3509 (class 0 OID 0)
-- Dependencies: 220
-- Name: weather_objects_id_seq1; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3334 (class 2606 OID 16536)
-- Name: categories categories_name_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.categories
    ADD CONSTRAINT categories_name_key UNIQUE (name);


--
-- TOC entry 3336 (class 2606 OID 16534)
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.categories
    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);


--
-- TOC entry 3338 (class 2606 OID 16580)
-- Name: deletion_requests deletion_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.deletion_requests
    ADD CONSTRAINT deletion_requests_pkey PRIMARY KEY (id);


--
-- TOC entry 3324 (class 2606 OID 16486)
-- Name: range_data station_meteo_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.range_data
    ADD CONSTRAINT station_meteo_pkey PRIMARY KEY (station_id);


--
-- TOC entry 3330 (class 2606 OID 16514)
-- Name: users users_email_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3332 (class 2606 OID 16512)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

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


--
-- TOC entry 3326 (class 2606 OID 16488)
-- Name: weather_data weather_data_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.weather_data
    ADD CONSTRAINT weather_data_pkey PRIMARY KEY (id);


--
-- TOC entry 3328 (class 2606 OID 16490)
-- Name: weather_objects weather_objects_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.weather_objects
    ADD CONSTRAINT weather_objects_pkey PRIMARY KEY (id);


--
-- TOC entry 3341 (class 2606 OID 16586)
-- Name: deletion_requests fk_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.deletion_requests
    ADD CONSTRAINT fk_user FOREIGN KEY (requested_by) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- TOC entry 3342 (class 2606 OID 16581)
-- Name: deletion_requests fk_weather_object; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.deletion_requests
    ADD CONSTRAINT fk_weather_object FOREIGN KEY (object_id) REFERENCES public.weather_objects(id) ON DELETE CASCADE;


--
-- TOC entry 3339 (class 2606 OID 16491)
-- Name: weather_data weather_data_station_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.weather_data
    ADD CONSTRAINT weather_data_station_id_fkey FOREIGN KEY (station_id) REFERENCES public.weather_objects(id);


--
-- TOC entry 3340 (class 2606 OID 16517)
-- Name: weather_objects weather_objects_proprio_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.weather_objects
    ADD CONSTRAINT weather_objects_proprio_id_fkey FOREIGN KEY (proprio_id) REFERENCES public.users(id) ON DELETE CASCADE;


-- Completed on 2025-04-13 11:04:16 CEST

--
-- PostgreSQL database dump complete
--

