26 lines
921 B
SQL
26 lines
921 B
SQL
create table objects
|
|
(
|
|
hash text not null, -- BLAKE3, 265 bits, base 16
|
|
size integer not null, -- in bytes
|
|
media_type text not null, -- RFC 6838 format
|
|
creation_date text not null, -- RFC 3339 format
|
|
primary key (hash)
|
|
) without rowid, strict;
|
|
|
|
create table object_replicas
|
|
(
|
|
hash text not null,
|
|
bucket_id text not null,
|
|
is_present integer not null, -- boolean
|
|
primary key (hash, bucket_id),
|
|
foreign key (hash) references objects (hash) on delete restrict on update restrict
|
|
) strict;
|
|
|
|
create table uploads
|
|
(
|
|
id text not null,
|
|
total_size integer not null, -- in bytes
|
|
hash text, -- null if the upload is not finished yet or the hash simply was not calculated yet
|
|
primary key (id),
|
|
foreign key (hash) references objects (hash) on delete restrict on update restrict
|
|
) without rowid, strict;
|