lotus/lib/harmony/harmonydb/sql/20240228-piece-park.sql

37 lines
978 B
MySQL
Raw Normal View History

2024-02-28 19:57:12 +00:00
create table parked_pieces (
2024-02-28 20:50:12 +00:00
id bigserial primary key,
2024-02-28 19:57:12 +00:00
created_at timestamp default current_timestamp,
piece_cid text not null,
piece_padded_size bigint not null,
piece_raw_size text not null,
2024-02-28 20:50:12 +00:00
2024-02-28 19:57:12 +00:00
complete boolean not null default false
);
2024-02-28 20:50:12 +00:00
/*
* This table is used to keep track of the references to the parked pieces
* so that we can delete them when they are no longer needed.
*
* All references into the parked_pieces table should be done through this table.
*/
2024-02-28 19:57:12 +00:00
create table parked_piece_refs (
2024-02-28 20:50:12 +00:00
ref_id bigserial primary key,
piece_id bigint not null,
2024-02-28 19:57:12 +00:00
foreign key (piece_id) references parked_pieces(id) on delete cascade
);
create table park_piece_tasks (
task_id bigint not null
constraint park_piece_tasks_pk
primary key,
2024-02-28 20:50:12 +00:00
piece_ref_id bigint not null,
2024-02-28 19:57:12 +00:00
data_url text not null,
data_headers jsonb not null default '{}',
data_raw_size bigint not null,
data_delete_on_finalize bool not null
);