Files
coa-server-manager/services/coa-registry/migrations/0001_realms.sql
T
ДмитрийandClaude Sonnet 5.5 1267bcc41e Phase 10: central realm Registry, Host publishing lifecycle, deployment
crates/coa-registry-proto (protocol 1: types, limits, signed-request canonicalisation, test vectors),
services/coa-registry (axum + PostgreSQL, migrations, rate limits, Dockerfile, deploy files),
services/coa-registry-e2e (Host lifecycle against the real service, live VPS gate),
coa-core realm_registry (identity keys, client, publishing loop on its own thread),
Settings -> Public listing card, docs REGISTRY_PROTOCOL.md and REGISTRY_DEPLOYMENT.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-07 20:23:13 +05:00

24 lines
1.6 KiB
SQL

-- Registry schema, migration 1. Forward-only: a released migration is never edited.
-- Discovery and presence data only. There is deliberately no table for players, characters, accounts, sessions or credentials.
CREATE TABLE realms (
realm_id uuid PRIMARY KEY,
public_key bytea NOT NULL CHECK (octet_length(public_key) = 32),
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL,
last_seen_at timestamptz NOT NULL,
published boolean NOT NULL,
display_name text NOT NULL CHECK (char_length(display_name) BETWEEN 1 AND 80),
description text NOT NULL CHECK (octet_length(description) <= 1024),
language text NOT NULL CHECK (char_length(language) BETWEEN 2 AND 16),
ruleset text NOT NULL CHECK (ruleset IN ('coa', 'wildcard')),
manager_version text NOT NULL CHECK (char_length(manager_version) BETWEEN 1 AND 32),
capabilities jsonb NOT NULL CHECK (octet_length(capabilities::text) <= 65536),
capabilities_hash text NOT NULL CHECK (capabilities_hash ~ '^[0-9a-f]{64}$'),
metadata_revision bigint NOT NULL CHECK (metadata_revision >= 1),
-- the timestamp of the last signed request that was applied; the next one must be strictly later (replay protection)
last_request_ts bigint NOT NULL,
player_count integer CHECK (player_count BETWEEN 0 AND 100000),
player_capacity integer CHECK (player_capacity BETWEEN 0 AND 100000)
);
CREATE INDEX realms_published_seen ON realms (published, last_seen_at);