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,
|
|
|
|
|
2024-03-14 11:24:00 +00:00
|
|
|
piece_cid text not null,
|
2024-02-28 19:57:12 +00:00
|
|
|
piece_padded_size bigint not null,
|
2024-03-14 12:03:14 +00:00
|
|
|
piece_raw_size bigint not null,
|
2024-02-28 20:50:12 +00:00
|
|
|
|
2024-02-29 10:11:40 +00:00
|
|
|
complete boolean not null default false,
|
|
|
|
task_id bigint default null,
|
|
|
|
|
2024-03-11 20:35:16 +00:00
|
|
|
cleanup_task_id bigint default null,
|
|
|
|
|
2024-03-14 11:24:00 +00:00
|
|
|
foreign key (task_id) references harmony_task (id) on delete set null,
|
2024-03-14 13:44:58 +00:00
|
|
|
foreign key (cleanup_task_id) references harmony_task (id) on delete set null,
|
2024-03-14 11:24:00 +00:00
|
|
|
unique (piece_cid)
|
2024-02-28 19:57:12 +00:00
|
|
|
);
|
|
|
|
|
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-29 10:11:40 +00:00
|
|
|
*
|
|
|
|
* data_url is optional for refs which also act as data sources.
|
2024-02-28 20:50:12 +00:00
|
|
|
*/
|
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
|
|
|
|
2024-02-29 10:11:40 +00:00
|
|
|
data_url text,
|
2024-02-28 19:57:12 +00:00
|
|
|
data_headers jsonb not null default '{}',
|
2024-02-29 10:11:40 +00:00
|
|
|
|
|
|
|
foreign key (piece_id) references parked_pieces(id) on delete cascade
|
2024-02-28 19:57:12 +00:00
|
|
|
);
|