drop table backup_parts;

create table backup_parts (
	id serial,
	backup_id int references backups(id),
	part_nr int not null check (part_nr > 0),
	tar_size bigint not null check (tar_size > 0),
	size bigint not null check (size > 0),
	md5 text not null,
	items int not null check (items > 0),
	date timestamp default now(),
	primary key(id)
);

-- ensure that backup part has unique numbers
create unique index backup_part_nr on backup_parts(backup_id,part_nr);

