2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 05:06:35 +00:00

db_create_sqlite.sql: contrib update script for SQLite

git-svn-id: https://svn.fhem.de/fhem/trunk@27036 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-01-12 19:47:59 +00:00
parent 3d87b917a7
commit 3f325a9281

View File

@ -1,3 +1,21 @@
###################################################################
# Usage:
# ======
#
# - Open a terminal session
# - goto a directory where the datbase should be created
# - create a new database:
# sudo sqlite3 <file> (e.g./opt/fhem/fhem.db)
#
# - change owner and user rights of the new file
#
# sudo chown fhem /opt/fhem/fhem.db
# sudo chmod 600 /opt/fhem/fhem.db
#
# - execute the statements shown below
#
###################################################################
PRAGMA auto_vacuum = FULL;
CREATE TABLE history (TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));
CREATE TABLE current (TIMESTAMP TIMESTAMP, DEVICE varchar(64), TYPE varchar(64), EVENT varchar(512), READING varchar(64), VALUE varchar(128), UNIT varchar(32));
CREATE INDEX Search_Idx ON `history` (DEVICE, READING, TIMESTAMP);