-- Detection classes table — write path owned by admin/, read path served by annotations/.
-- Both services point at the same Postgres database, so this DDL is idempotent and safe to
-- (re-)run from either side. AZ-513.

create table if not exists detection_classes
(
    id          serial           primary key,
    name        varchar(120)     not null,
    short_name  varchar(20)      not null,
    color       varchar(20)      not null,
    max_size_m  double precision not null,
    photo_mode  varchar(20)      null,
    created_at  timestamp        not null default now()
);

grant select, insert, update, delete on public.detection_classes to azaion_admin;
grant usage, select on sequence public.detection_classes_id_seq  to azaion_admin;
grant select                                  on public.detection_classes  to azaion_reader;
