feat: multi-ruleset realms and strictly isolated portable characters

This commit is contained in:
Дмитрий committed 2026-10-22 13:04:57 +05:00
1 parent d9c10c4564
commit 58a99f0a6d
35 files changed
+736 -124

No files matched your search

@@ -0,0 +1,3 @@
-- Registry schema, migration 5: add 'reborn' to supported rulesets.
ALTER TABLE realms DROP CONSTRAINT IF EXISTS realms_ruleset_check;
ALTER TABLE realms ADD CONSTRAINT realms_ruleset_check CHECK (ruleset IN ('coa', 'wildcard', 'reborn'));
+3
View File
@@ -14,6 +14,7 @@ const MIGRATIONS: &[(i32, &str, &str)] = &[
(2, "protocol_v2", include_str!("../migrations/0002_protocol_v2.sql")),
(3, "browse_indexes", include_str!("../migrations/0003_browse_indexes.sql")),
(4, "created_whole_seconds", include_str!("../migrations/0004_created_whole_seconds.sql")),
(5, "reborn_ruleset", include_str!("../migrations/0005_reborn_ruleset.sql")),
];
pub struct PgConfig {
@@ -124,6 +125,7 @@ pub(crate) fn to_row(r: &Row) -> StoreResult<RealmRow> {
ruleset: match ruleset.as_str() {
"coa" => Ruleset::Coa,
"wildcard" => Ruleset::Wildcard,
"reborn" => Ruleset::Reborn,
other => return Err(StoreError::Backend(format!("a stored ruleset is unknown: {other}"))),
},
level_cap: level_cap.map(|n| n as u32),
@@ -179,6 +181,7 @@ fn summary_from(r: &Row, now: i64, ttl: i64) -> StoreResult<RealmSummary> {
ruleset: match ruleset.as_str() {
"coa" => Ruleset::Coa,
"wildcard" => Ruleset::Wildcard,
"reborn" => Ruleset::Reborn,
other => return Err(StoreError::Backend(format!("a stored ruleset is unknown: {other}"))),
},
level_cap: level_cap.map(|n| n as u32),