feat(db): guilds, guild_members, guild_invites and guild_events

Four tables (MySQL migration 97, SQLite 80) and the IGuilds interface with MySQL, SQLite and TestSQL implementations,
for the guild system (docs/Guilds.md). A guild has a name (unique without regard to case), a name status like
pet_names (1 waiting for moderation, 2 approved), its founder and when it was made. A character is in at most one guild
(guild_members, with its rank: 1 leader, 2 officer, 3 veteran, 4 recruit, the client's names, and when it joined) and
has at most one pending invite (guild_invites). guild_events is each guild's history and outlives the guild. Deleting a
character removes its membership and the invites to and from it. Nothing uses the tables yet.

Check: both migrations run on a fresh and an existing database; DatabaseParityTests Guilds passes against MariaDB
(DLU_TEST_MYSQL_HOST) and SQLite gives the same results. Nothing to check in game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 05:40:38 -05:00
parent c99e2a719f
commit 88ebdf685e
14 changed files with 645 additions and 1 deletions

View File

@@ -214,6 +214,22 @@ class TestSQLDatabase : public GameDatabase {
std::vector<AccountNote> GetAccountNotes(uint32_t accountId) override { return {}; }
std::optional<AccountNote> GetAccountNote(uint64_t id) override { return {}; }
void DeleteAccountNote(uint64_t id) override {}
int64_t InsertGuild(const Guild& guild) override { return 0; }
std::optional<Guild> GetGuild(int64_t guildId) override { return {}; }
std::optional<Guild> GetGuildByName(const std::string& name) override { return {}; }
void SetGuildName(int64_t guildId, const std::string& name, int32_t nameStatus) override {}
void DeleteGuild(int64_t guildId) override {}
void AddGuildMember(const Member& member) override {}
void RemoveGuildMember(LWOOBJID characterId) override {}
void SetGuildMemberRank(LWOOBJID characterId, uint8_t rank) override {}
std::optional<Member> GetGuildMember(LWOOBJID characterId) override { return {}; }
std::vector<Member> GetGuildMembers(int64_t guildId) override { return {}; }
void SetGuildInvite(const Invite& invite) override {}
std::optional<Invite> GetGuildInvite(LWOOBJID characterId) override { return {}; }
void DeleteGuildInvite(LWOOBJID characterId) override {}
uint64_t InsertGuildEvent(const Event& event) override { return 0; }
std::vector<Event> GetGuildEvents(int64_t guildId, uint32_t limit) override { return {}; }
GuildPage GetGuildPage(uint32_t start, uint32_t length, const std::string& search, bool pendingOnly) override { return {}; }
uint64_t InsertPermissionGrant(const Grant& grant) override { return 0; }
std::optional<Grant> GetPermissionGrant(uint64_t id) override { return {}; }
std::vector<Grant> GetPermissionGrants(const std::string& targetType, int64_t targetId) override { return {}; }