commit 86e9d8046dec817eb1e41ea98ce6a29dea732af9
parent 1facc09d29ab5558c924481f06c3ebaae6433e6d
Author: Natasha Kerensikova <natgh@instinctive.eu>
Date: Tue, 22 Apr 2025 18:19:29 +0000
SQL schema is corrected
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/mqttagent-full/main.go b/cmd/mqttagent-full/main.go
@@ -132,9 +132,9 @@ func connect(connectionString string) (*sqlogger, error) {
"CREATE TABLE IF NOT EXISTS topics" +
"(id INTEGER PRIMARY KEY AUTOINCREMENT," +
" name TEXT NOT NULL);",
- "CREATE INDEX IF NOT EXISTS i_topics ON topics(name);",
+ "CREATE UNIQUE INDEX IF NOT EXISTS i_topics ON topics(name);",
"CREATE TABLE IF NOT EXISTS received" +
- "(timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP," +
+ "(timestamp REAL NOT NULL," +
" topic_id INTEGER NOT NULL," +
" message TEXT NOT NULL," +
" FOREIGN KEY (topic_id) REFERENCES topics (id));",