refactor to add ingest batchs for better traceability

This commit is contained in:
2025-10-23 18:11:26 +02:00
parent 1f0eb18a5f
commit fb4d31afba
6 changed files with 104 additions and 23 deletions
@@ -1,16 +1,32 @@
create extension citext; -- noqa
create table public.ingest_batch
(
id serial primary key,
elapsed_ms int not null default 0,
file_checksum text not null,
created_at timestamp not null default now()
);
create index idx_ingest_batch_file_checksum on public.ingest_batch (
file_checksum
);
create table public.meteo_data
(
id serial primary key,
batch_id int not null references public.ingest_batch (id),
location_name citext not null,
max_temp numeric(5,2) not null,
min_temp numeric(5,2) not null,
rainfall numeric(5,2) not null,
date_of_register date not null,
max_temp numeric(5, 2) not null,
min_temp numeric(5, 2) not null,
rainfall numeric(5, 2) not null,
cloudiness int not null,
created_at date not null default now()
created_at timestamp not null default now()
);
create index idx_meteo_data_location_name on public.meteo_data (location_name);
@@ -18,6 +34,8 @@ create index idx_meteo_data_location_name on public.meteo_data (location_name);
create table public.rejected_data
(
id serial primary key,
batch_id int not null references public.ingest_batch (id),
raw_data text not null,
reason text default null,