gotelem/internal/db/migrations/1_initial_up.sql

15 lines
365 B
MySQL
Raw Normal View History

2023-07-06 02:16:12 +00:00
CREATE TABLE "bus_events" (
"ts" INTEGER NOT NULL, -- timestamp, unix milliseconds
"name" TEXT NOT NULL, -- name of base packet
"data" JSON NOT NULL CHECK(json_valid(data)) -- JSON object describing the data, including index if any
2023-07-06 02:16:12 +00:00
);
CREATE INDEX "ids_timestamped" ON "bus_events" (
"name",
2023-07-06 02:16:12 +00:00
"ts" DESC
);
CREATE INDEX "times" ON "bus_events" (
"ts" DESC
);