24 lines
698 B
SQL
24 lines
698 B
SQL
create table firmware (
|
|
id int not null auto_increment,
|
|
device_id bigint not null,
|
|
version int not null,
|
|
path varchar(4096) not null,
|
|
sha256 char(64),
|
|
size int,
|
|
uploaded_at timestamp not null default current_timestamp,
|
|
primary key (id),
|
|
foreign key (device_id) references devices(id),
|
|
|
|
unique(device_id, version)
|
|
);
|
|
|
|
create table firmware_updates (
|
|
id int not null auto_increment,
|
|
firmware_id int not null,
|
|
status varchar(32) not null, -- pending / sent / applied / failed
|
|
requested_at timestamp not null default current_timestamp,
|
|
applied_at timestamp null,
|
|
|
|
primary key (id),
|
|
foreign key (firmware_id) references firmware(id)
|
|
); |