PKGBUILD/pkg/repository/db/sqlite3/createTableTemperatures.sql

10 lines
586 B
SQL

CREATE TABLE IF NOT EXISTS temperatures (
temperature_id CHAR(37) PRIMARY KEY,
temperature_value NUMERIC(10,3) NOT NULL,
temperature_from_date TIMESTAMP NOT NULL,
temperature_till_date TIMESTAMP,
sensor_id CHAR(37) NOT NULL,
creation_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
update_date TIMESTAMP,
FOREIGN KEY(sensor_id) REFERENCES sensors(sensor_id)
);