2021-12-24 00:08:38 -05:00
|
|
|
--
|
|
|
|
create extension if not exists "uuid-ossp";
|
|
|
|
--
|
|
|
|
create extension if not exists timescaledb;
|
|
|
|
--
|
|
|
|
create schema if not exists heimdall;
|
|
|
|
--
|
|
|
|
create table if not exists heimdall.player_positions (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
|
|
|
PRIMARY KEY (time, player, world)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.player_positions', 'time', 'player', 4, if_not_exists => TRUE);
|
2021-12-24 01:32:40 -05:00
|
|
|
--
|
|
|
|
create table if not exists heimdall.block_breaks (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
2021-12-24 19:04:03 -05:00
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
|
|
|
block text not null,
|
2021-12-24 01:32:40 -05:00
|
|
|
PRIMARY KEY (time, player, world)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.block_breaks', 'time', 'player', 4, if_not_exists => TRUE);
|
|
|
|
--
|
|
|
|
create table if not exists heimdall.block_places (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
2021-12-24 19:04:03 -05:00
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
|
|
|
block text not null,
|
2021-12-24 01:32:40 -05:00
|
|
|
PRIMARY KEY (time, player, world)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.block_places', 'time', 'player', 4, if_not_exists => TRUE);
|
2021-12-24 02:42:13 -05:00
|
|
|
--
|
|
|
|
create table if not exists heimdall.player_sessions (
|
2021-12-24 02:49:53 -05:00
|
|
|
id uuid not null,
|
2021-12-24 02:42:13 -05:00
|
|
|
player uuid not null,
|
|
|
|
name text not null,
|
|
|
|
"start" timestamp not null,
|
|
|
|
"end" timestamp not null,
|
2021-12-24 02:49:53 -05:00
|
|
|
primary key (id, player, start)
|
2021-12-24 02:42:13 -05:00
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.player_sessions', 'start', 'player', 4, if_not_exists => TRUE);
|
2021-12-24 03:31:48 -05:00
|
|
|
--
|
|
|
|
create table if not exists heimdall.world_changes (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
from_world uuid not null,
|
|
|
|
from_world_name text not null,
|
|
|
|
to_world uuid not null,
|
2021-12-24 04:10:29 -05:00
|
|
|
to_world_name text not null,
|
|
|
|
primary key (time, player)
|
2021-12-24 03:31:48 -05:00
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.world_changes', 'time', 'player', 4, if_not_exists => TRUE);
|
2021-12-24 04:10:29 -05:00
|
|
|
--
|
|
|
|
create table if not exists heimdall.player_deaths (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
|
|
|
experience double precision not null,
|
|
|
|
message text null,
|
|
|
|
primary key (time, player)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.player_deaths', 'time', 'player', 4, if_not_exists => TRUE);
|
|
|
|
--
|
|
|
|
create table if not exists heimdall.player_advancements (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
2021-12-24 19:04:03 -05:00
|
|
|
advancement text not null,
|
2021-12-24 04:10:29 -05:00
|
|
|
primary key (time, player, advancement)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.player_advancements', 'time', 'player', 4, if_not_exists => TRUE);
|
2021-12-24 19:04:03 -05:00
|
|
|
--
|
|
|
|
create table if not exists heimdall.entity_kills (
|
|
|
|
time timestamp not null,
|
|
|
|
player uuid not null,
|
|
|
|
entity uuid not null,
|
|
|
|
world uuid not null,
|
|
|
|
x double precision not null,
|
|
|
|
y double precision not null,
|
|
|
|
z double precision not null,
|
|
|
|
pitch double precision not null,
|
|
|
|
yaw double precision not null,
|
|
|
|
entity_type text not null,
|
|
|
|
primary key (time, entity, player)
|
|
|
|
);
|
|
|
|
--
|
|
|
|
select create_hypertable('heimdall.entity_kills', 'time', 'player', 4, if_not_exists => TRUE);
|