mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
2.7 KiB
2.7 KiB
SQL guidelines
Adding SQL updates
cd data/sql/updates/pending_db_world/(orpending_db_auth/pending_db_characters)../create_sql.shgenerates an emptyrev_<timestamp>.sqlto write into.- Conventions (linted): every
INSERTpreceded by a matchingDELETE(idempotency); spawnDELETEandUPDATE(creature,gameobject) target that table alone (no join, comma list or schema qualifier) and filter on bothidandguidwith=/IN/BETWEEN, neverOR; no double semicolons; no multiple blank lines; InnoDB engine.
Run the linter before claiming a change is done: python apps/codestyle/codestyle-sql.py (compares to origin/master).
Data conventions
- Set
flags_extraon everydifficulty_entry_*template, not just the base entry: which of the two the engine reads varies by call site. smart_scriptsedits always rewrite the full block —DELETE+INSERTof every row for the(entryorguid, source_type)pair, with theDELETEmatching both columns — never a partialUPDATE, not even for a comment-only fix.- Sniff-backed changes stamp
VerifiedBuild(the sniff's client build) on every row the sniff validated, including rows the fix doesn't otherwise touch. creature_template_model: rows were generated from the oldmodelid1-modelid4columns, and that migration copiedcreature_template.VerifiedBuildonto everyIdx, so equal probabilities are that import's default rather than a randomization claim. Judge a stamp by its build, not itsIdx: a legacy build on the extra rows is migration noise, while later sniff passes stampIdx>= 1 legitimately. Authority is the creature query response's per-indexProbability, which Classic and retail sniffs carry and 3.3.5 clients omit. Suppress a model by setting itsProbabilityto 0 and keeping the row, never by deleting it; keep a creature's only row at 1, since the loader reads a zero total as equal chance and resets every row to 1.0.creature_immunities: negative ids are curated shared sets — reference them viacreature_template.CreatureImmunitiesId, never edit them or allocate new ones. Positive ids are single-creature sets — reuse an existing set only on an exact match; to extend a creature's immunities, insert a superset under a new id and point the creature'sCreatureImmunitiesIdat it.
The three databases
acore_auth— accounts, realm list, IP/account bans, session keys. Shared across all realms.acore_characters— per-character state: characters, inventory, in-progress quests, mail, guilds, arena teams, achievements. One per realm.acore_world— static game content: creature/gameobject/item/quest templates, spawn lists, loot tables, SmartAI scripts, gossip, conditions. Read-mostly; rebuilt from SQL.