diff --git a/.gitignore b/.gitignore index b995949..969dd17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /target -/migrations .idea config.toml .env \ No newline at end of file diff --git a/migrations/20260327_init.sql b/migrations/20260327_init.sql new file mode 100644 index 0000000..c34f5a9 --- /dev/null +++ b/migrations/20260327_init.sql @@ -0,0 +1,75 @@ +create table if not exists favicons ( + hash bytea primary key, + data text not null, + first_seen timestamp without time zone not null default now () +); + +create table if not exists countries ( + network inet, + country text not null, + country_code text not null, + asn text, + asn_name text, + primary key (network) +); + +create table if not exists servers ( + address inet, + port integer, + first_seen timestamp without time zone not null default now (), + last_seen timestamp without time zone not null, + last_time_player_online timestamp without time zone not null, + last_time_no_players_online timestamp without time zone not null, + version_protocol integer not null, + version_name text not null, + enforces_secure_chat boolean not null, + previews_chat boolean not null, + is_online_mode boolean not null, + is_whitelisted boolean not null, + favicon_hash bytea references favicons (hash), + max_players integer, + online_players integer, + description_formatted text, + description_raw jsonb, + + -- neoforge + is_modded boolean, + + -- forge + fml_network_version integer, + + -- nochatreports + prevents_chat_reports boolean, + + -- better compatibility checker + bcc_modpack_projectid integer, + bcc_modpack_version text, + bcc_modpack_name text, + + primary key (address, port) +); + +create table if not exists players ( + address inet, + port integer, + uuid uuid, + username text not null, + is_online_mode boolean not null, + first_seen timestamp without time zone not null default now (), + last_seen timestamp without time zone not null, + primary key (address, port, uuid), + foreign key (address, port) references servers (address, port) on delete cascade +); + +create table if not exists mods ( + address inet, + port integer, + id text, + mod_marker text, + primary key (address, port, id), + foreign key (address, port) references servers (address, port) on delete cascade +); + +-- Indexes + +create index if not exists countries_index on countries using gist (network inet_ops);