add get cities handler and improve db schema

This commit is contained in:
2025-10-29 16:14:25 +01:00
parent 5560fad92e
commit a5a2c5e24d
4 changed files with 39 additions and 4 deletions
@@ -1,4 +1,10 @@
create extension citext; -- noqa
create extension unaccent;
create or replace function immutable_unaccent(text)
returns text as $$
select unaccent('unaccent', $1);
$$ language sql immutable;
create table public.ingest_batch
(
@@ -20,6 +26,7 @@ create table public.meteo_data
batch_id int not null references public.ingest_batch (id),
location_name citext not null,
location_name_norm text generated always as (immutable_unaccent(lower(location_name))) stored,
date_of_register date not null,
max_temp numeric(5, 2) not null,
min_temp numeric(5, 2) not null,
@@ -29,7 +36,7 @@ create table public.meteo_data
created_at timestamp not null default now()
);
create index idx_meteo_data_location_name on public.meteo_data (location_name);
create index idx_meteo_data_location_name_norm on public.meteo_data (location_name_norm);
create table public.rejected_data
(