Skip to content

Commit

Permalink
feat: Update reading table schema
Browse files Browse the repository at this point in the history
Using id and origin as index for TimescaleDB integration

Signed-off-by: bruce <[email protected]>
  • Loading branch information
weichou1229 committed Jan 10, 2025
1 parent 0d11a11 commit 4adb933
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/core-data/res/db/sql/01-tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS core_data.event (

-- core_data.reading is used to store the reading information
CREATE TABLE IF NOT EXISTS core_data.reading (
id UUID PRIMARY KEY,
id UUID,
event_id UUID,
devicename TEXT,
profilename TEXT,
Expand All @@ -32,3 +32,6 @@ CREATE TABLE IF NOT EXISTS core_data.reading (
FOREIGN KEY(event_id)
REFERENCES core_data.event(id)
);

CREATE UNIQUE INDEX IF NOT EXISTS idx_reading_id_origin
ON core_data.reading(id, origin) -- Using id and origin as index for TimescaleDB integration

0 comments on commit 4adb933

Please sign in to comment.