


alter table dataset
    add constraint acquisition_ref
    foreign key (acquisition_id) references acquisition;


-- The Modis ingester contains multiple datasets of different processing levels in a single NetCDF file.
-- Replace the unique path constraint with a unique (path, processing level) constraint.

alter table dataset
    drop constraint dataset_path_key;

drop index dataset_dataset_path_idx;

alter table dataset
    add constraint dataset_path_level
    unique (dataset_path, level_id);



alter table dataset
    add constraint acquisition_ref
    foreign key (acquisition_id) references acquisition;


-- The Modis ingester contains multiple datasets of different processing levels in a single NetCDF file.
-- Replace the unique path constraint with a unique (path, processing level) constraint.

alter table dataset
    drop constraint dataset_path_key;

drop index dataset_dataset_path_idx;


create unique index dataset_dataset_path_level_id_idx
    on public.dataset(dataset_path, level_id);

alter table dataset
    add constraint dataset_path_level_uniq
    unique using index dataset_dataset_path_level_id_idx;
Replace the implicit unique index with an explicit one.
Replace the implicit unique index with an explicit one.

This is functionally identical, but because we rely on this index we should make it explicit and named.

(for example, if the unique constraint was dropped in the future we would still want the column[s] indexed.)
