Files
nym/nym-statistics-api/migrations/001_init.sql
T
Simon Wicky b69c2e1e94 Nym Statistics API (#5800)
* move stats types from vpn-client to here

* base stats api

* change storage schema

* add link to nymAPI for whitelisting

* remove outdated comment

* more comments update

* example of chrono vs time

* Add build.rs
- exports DATABASE_URL so cargo check works
- exports SQLX_OFFLINE for CI
- added pg_up.sh which spawns PG container
  - required for cargo sqlx prepare

* fixes time vs chrono issue and cleaner build with docker

* add correct swagger types, with feature locking where relevant

* apply dynco suggestions

---------

Co-authored-by: dynco-nym <173912580+dynco-nym@users.noreply.github.com>
2025-05-28 10:23:11 +02:00

24 lines
598 B
SQL

CREATE TABLE active_device (
day DATE NOT NULL,
device_id TEXT NOT NULL,
os_type TEXT,
os_version TEXT,
architecture TEXT,
app_version TEXT,
user_agent TEXT,
from_mixnet BOOLEAN,
PRIMARY KEY (device_id, day)
);
CREATE TABLE connection_stats (
received_at TIMESTAMP WITH TIME ZONE NOT NULL,
connection_time_ms INTEGER,
two_hop BOOLEAN,
source_ip TEXT,
country_code TEXT,
from_mixnet BOOLEAN
);
CREATE INDEX idx_active_device_day ON active_device (day);