minna-caos/migrations/20250321201214_initial.sql
2025-03-29 23:54:55 +01:00

34 lines
No EOL
1.1 KiB
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 ongoing_uploads
(
id text not null,
current_size integer not null, -- in bytes
total_size integer, -- in bytes, or null if the upload was not started yet
primary key (id)
) without rowid, strict;
create table finished_uploads
(
id text not null,
size integer not null, -- in bytes
hash text not null, -- BLAKE3, 265 bits, base 16
media_type text not null, -- RFC 6838 format
primary key (id)
) without rowid, strict;