10 lines
718 B
SQL
10 lines
718 B
SQL
CREATE TABLE temperatures (
|
|
id CHAR(36) NOT NULL,
|
|
value NUMERIC(10,3) NOT NULL,
|
|
date TIMESTAMP WITH TIME ZONE NOT NULL,
|
|
sensor_id CHAR(36) NOT NULL,
|
|
creation_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
update_date TIMESTAMP WITH TIME ZONE,
|
|
CONSTRAINT pk_temperatures PRIMARY KEY (id),
|
|
CONSTRAINT fk_temperatures_sensor_id FOREIGN KEY (sensor_id) REFERENCES sensors(sensor_id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
); |