Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 43df826

Browse files
author
Dominik František Bučík
authored
Merge pull request #52 from CESNET/postgres-tables
docs: postgres table definitions
2 parents 454bbea + 5521291 commit 43df826

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
CREATE TABLE "statistics_sums" (
2+
"id" BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
3+
"year" INTEGER NOT NULL,
4+
"month" INTEGER DEFAULT NULL,
5+
"day" INTEGER DEFAULT NULL,
6+
"idp_id" INTEGER NOT NULL DEFAULT 0,
7+
"sp_id" INTEGER NOT NULL DEFAULT 0,
8+
"logins" INTEGER DEFAULT NULL,
9+
"users" INTEGER DEFAULT NULL,
10+
CONSTRAINT "year" UNIQUE ("year","month","day","idp_id","sp_id")
11+
);
12+
13+
CREATE INDEX "statistics_sums_idp_id" ON "statistics_sums" ("idp_id");
14+
CREATE INDEX "statistics_sums_sp_id" ON "statistics_sums" ("sp_id");
15+
16+
CREATE TABLE "statistics_per_user" (
17+
"day" DATE NOT NULL,
18+
"idp_id" INTEGER NOT NULL,
19+
"sp_id" INTEGER NOT NULL,
20+
"user" VARCHAR(255) NOT NULL,
21+
"logins" INTEGER DEFAULT '1',
22+
CONSTRAINT primary_key PRIMARY KEY ("day","idp_id","sp_id","user")
23+
);
24+
25+
CREATE INDEX "statistics_per_user_idp_id" ON "statistics_per_user" ("idp_id");
26+
CREATE INDEX "statistics_per_user_sp_id" ON "statistics_per_user" ("sp_id");
27+
28+
CREATE TABLE "statistics_idp" (
29+
"idp_id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
30+
"identifier" VARCHAR(255) NOT NULL UNIQUE,
31+
"name" VARCHAR(255) NOT NULL
32+
);
33+
34+
CREATE TABLE "statistics_sp" (
35+
"sp_id" INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
36+
"identifier" VARCHAR(255) NOT NULL UNIQUE,
37+
"name" VARCHAR(255) NOT NULL
38+
);

0 commit comments

Comments
 (0)