Jump to content

[README] What if ERROR:Table `db_version` have field `required_(etc)` but expected...


Guest SeySayux

Recommended Posts

Since this is a very common problem, I'm going to make this clear once and for all.

You need to apply some SQL updates.

"SQL updates? What's that? Never heard of those? Could you explain?"

I'm glad you asked. Since the mangos db is huge, it would be a terrible pain in the backside to make a new full db dump with each revision. Therefore, they release a full database only so often, and you have to apply patches to make it up to date yourself.

"Okay, makes sense. But where do I download those updates?"

You probably already have them! They're in the sql/updates folder of your mangos checkout.. There are quite a lot of them, so you can't miss them. They're all in the form of rXXXX_NN_database_table.sql, where XXXX is a revision number, NN is the number of the update for that revision, database is a database (duh), table is the table they update, and sql is well... the extension of the file.

"Whoa, that's monstrous! Do I need to apply all those?"

No, not at all. You only need to apply updates with a version number higher than the current version of the db. Everything else is already just fine.

"Yes, that makes sense too. But what version of DB am I using? Not the right one, it seems."

That's where your error message can help you.

ERROR:Table `db_version` have field `required_XXXX_01_(etc)` but expected `required_YYYY_01_(etc)`! Not all sql updates applied?

Here is YYYY your current running revision, or the latest sql update for this revision. XXXX is the revision that's currently in your db. You need to update from XXXX to latest..

"Okay, but that's still a lot. How am I ever going to do that?"

That's where scripting comes in handy. In the examples below, substitute <username> for your mysql username, and <password> for your mysql password.

First, copy all updates you need to a serperate folder. Next, open a shell and run the following script (depending on your OS):

Windows:

(I'm going to assume mysql is in your path. Also, you'll need Windows PowerShell. No, I'm not going to do a cmd.exe one. Ever.)

foreach($table in "mangos characters realmd") {
   foreach($x in ls *$table*.sql) {
       mysql -u<username> -p<password> -e "source $x"
   }
}

Mac OS X, Linux, or anything that uses bash:

for table in 'mangos characters realmd'; do
   for x in *$table*.sql; do
       mysql -u<username> -p<password> < $x
   done
done

"Whoa, great, everything worked! You saved my day! Thanks man! :cool:"

No problem. You're welcome. :)

"Erm... I'm getting a lot of errors. It still doesn't work."

Try checking and double-checking if you did everything right. If you are sure, but I mean really sure you did everything right, open a new topic. If you did something wrong which was obviously explained in this FAQ, you'll be the laughing stack of the week. So you better be darn sure.

If you have comments on how to improve this guide, please post!

Note to mods: could this be stickied?

Link to comment
Share on other sites

Also, from what I understand, the "UDB_0.12.0_mangos_9582_SD2_1639.sql" I downloaded from http://unifieddb.svn.sourceforge.net/viewvc/unifieddb/trunk/Full_DB/ is a compound version of all the "XXXX_NN_database_table.sql" files combined. Correct?

But then what are the "390_corepatch_mangos_9631_to_9763.sql" files I downloaded? Do they simply restructure all of my tables (opposed to populating them)? Do I need to apply them sequentially as well? If the latest UDB version is 9582, do I need to apply "389_corepatch_mangos_9583_to_9630.sql" and then "390_corepatch_mangos_9631_to_9763.sql"?

And what are the "390_updatepack_mangos.sql" files? A compilation of the "XXXX_NN_database_table.sql" files?

A lot of things make more sense, but I still don't know what the majority of the files are or what they do.

Link to comment
Share on other sites

Tyler:

PART 15 - UPDATING YOUR DATABASE WITH SQL FILES

** Core updates and Contents updates aren’t the same. Core files made by the Mangos team are the structure of your tables in the database. UDB will take the Core and populate them. So the UDB Core will have your Mangos structure and the Data up to a certain version.

So if we recap....

You have a DATABASE called MANGOS

We will refer to 2 things: the UDB CORE_PATCH and the UDB UPDATE_PATCH

a CORE_PATCH contain the tables, columns etc etc but they are Empty.....theres no value, theres no row....its like the frame of a car but without the seat ...the engine ...etc...

an UDB UPDATE_PATCH, theres goes your value in your columns.... theres your rows.... theres your seats....lmao

the CORE_PATCH is always made by the MANGOS team .... but you will also find them in them on the UDB download site ...because of course you can't populate the table if the table doesn't exist....

why they are split up ...simple .... you may not want to have a creature do 50 damage....you might want it to do 1000 damage....so the MANGOS team will give you the basic.... the tools....the tables...

Then you go find your data... such UDB ... or some other prefer YTDP or wahtever its called....

so when you UPDATE your Mangos software (not talking about core update or udb update...im talking about getting mangos repository up to date) , in the sql/updates you will find the CORE updates.... but you can also find them on the UDB Core pack as they took them from mangos and provided them to you in a patch ..... called CORE_PATCH....

So its simply logic that you need to run the CORE_PATCH file before the UPDATE_PATCH file in your sql database....

that you do Mangos first or Characters or realm, it doesnt matter.... they are separate database.... but you may need to update them all as i don't know if one may refer to an other.....

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use