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

32 lines
956 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,
2024-02-29 10:11:40 +00:00
piece_cid text not null unique constraint parked_pieces_piece_cid_key,
2024-02-28 19:57:12 +00:00
piece_padded_size bigint not null,
piece_raw_size text 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,
foreign key (task_id) references harmony_task (id) on delete set null
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
);