2020-06-01 20:36:57 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS humidities (
|
|
|
|
id CHAR(36) CONSTRAINT pk_humidities PRIMARY KEY,
|
|
|
|
value NUMERIC(10,3) NOT NULL,
|
2020-10-07 21:38:27 +00:00
|
|
|
date TIMESTAMP WITH TIME ZONE NOT NULL,
|
2020-06-01 20:36:57 +00:00
|
|
|
sensor_id CHAR(36) NOT NULL,
|
2020-10-07 21:38:27 +00:00
|
|
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
|
|
update_date TIMESTAMP WITH TIME ZONE
|
2020-06-01 20:36:57 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
ALTER TABLE humidities
|
|
|
|
ADD FOREIGN KEY (sensor_id)
|
|
|
|
REFERENCES sensors(sensor_id)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE CASCADE;
|