Add hardware ingest flow and UI upload
This commit is contained in:
7
migrations/0007_hardware_ingest/down.sql
Normal file
7
migrations/0007_hardware_ingest/down.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
DROP TABLE IF EXISTS asset_firmware_states;
|
||||
|
||||
ALTER TABLE timeline_events
|
||||
DROP COLUMN details;
|
||||
|
||||
ALTER TABLE observations
|
||||
DROP COLUMN details;
|
||||
16
migrations/0007_hardware_ingest/up.sql
Normal file
16
migrations/0007_hardware_ingest/up.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
ALTER TABLE observations
|
||||
ADD COLUMN details JSON NULL;
|
||||
|
||||
ALTER TABLE timeline_events
|
||||
ADD COLUMN details JSON NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS asset_firmware_states (
|
||||
asset_id BIGINT NOT NULL,
|
||||
device_name VARCHAR(255) NOT NULL,
|
||||
firmware_version VARCHAR(255) NOT NULL,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (asset_id, device_name),
|
||||
CONSTRAINT fk_asset_firmware_states_asset
|
||||
FOREIGN KEY (asset_id) REFERENCES assets(id)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
);
|
||||
5
migrations/0008_service_uniques/down.sql
Normal file
5
migrations/0008_service_uniques/down.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE projects
|
||||
DROP INDEX uniq_projects_customer_name;
|
||||
|
||||
ALTER TABLE customers
|
||||
DROP INDEX uniq_customers_name;
|
||||
5
migrations/0008_service_uniques/up.sql
Normal file
5
migrations/0008_service_uniques/up.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE customers
|
||||
ADD UNIQUE KEY uniq_customers_name (name);
|
||||
|
||||
ALTER TABLE projects
|
||||
ADD UNIQUE KEY uniq_projects_customer_name (customer_id, name);
|
||||
Reference in New Issue
Block a user