summaryrefslogtreecommitdiff
path: root/src/sw-collector/sw_collector_tables.sql
blob: b7b430b3c7606b17d8424ace57d77a081f8c6cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* SQLit database for an Endpoint Collector */

DROP TABLE IF EXISTS "events";
CREATE TABLE "events" (
  "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  "epoch" INTEGER NOT NULL,
  "timestamp" CHAR(20) NOT NULL
);

DROP TABLE IF EXISTS "sw_identifiers";
CREATE TABLE "sw_identifiers" (
  "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  "name" VARCHAR(255) NOT NULL,
  "package" VARCHAR(255) NOT NULL,
  "version" VARCHAR(255) NOT NULL,
  "source" INTEGER DEFAULT 0,
  "installed" INTEGER DEFAULT 1,
  "tag" TEXT
  );
DROP INDEX IF EXISTS "sw_identifiers_name";
CREATE INDEX "sw_identifiers_name" ON "sw_identifiers" (
  "name"
);

DROP TABLE IF EXISTS "sw_events";
CREATE TABLE "sw_events" (
  "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  "eid" INTEGER REFERENCES "events" ("id"),
  "sw_id" INTEGER NOT NULL REFERENCES "sw_identifiers" ("id"),
  "action" INTEGER NOT NULL
);