2020-05-21 15:40:24 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS sensors (
|
2020-06-01 20:36:57 +00:00
|
|
|
sensor_id CHAR(36) PRIMARY KEY,
|
2020-05-21 15:40:24 +00:00
|
|
|
sensor_name VARCHAR(64) NOT NULL,
|
|
|
|
sensor_location VARCHAR(64),
|
|
|
|
wire_id VARCHAR(64),
|
|
|
|
i2c_bus VARCHAR(255),
|
|
|
|
i2c_address VARCHAR(12),
|
|
|
|
gpio_number VARCHAR(6),
|
|
|
|
sensor_model VARCHAR(16) NOT NULL,
|
|
|
|
sensor_enabled INTEGER(1) DEFAULT 1 NOT NULL,
|
2020-05-31 22:52:54 +00:00
|
|
|
tick_duration VARCHAR(6) NOT NULL,
|
2020-06-01 20:36:57 +00:00
|
|
|
device_id CHAR(36) NOT NULL,
|
2020-05-21 15:40:24 +00:00
|
|
|
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
2020-06-01 20:36:57 +00:00
|
|
|
update_date TIMESTAMP,
|
2020-05-21 15:40:24 +00:00
|
|
|
FOREIGN KEY(device_id) REFERENCES devices(device_id)
|
|
|
|
);
|