Jump to content

A stupid question


Recommended Posts

I have also made a SQL updater in Python which will actually check for the last update and then apply any after that.

http://getmangos.eu/community/topic/15590/python-yet-another-script-for-sql-updates/

Well, pythod scripts will require you to have Pythod env installed, while console binary can run on any supported platform since runtime is already there :P Yeah, pythod is great but we are here to learn something, aren't we :rolleyes:

So Windows batch scripts can run on Linux and bash scripts can run on Windows?

And before saying "install bash" why not "install Python"?

Python is still a better cross-platform solution. It has a standard language that runs on every platform Python supports (pretty much all of them.) Shell scripts have many different languages for many different platforms.

Link to comment
Share on other sites

  • 40 years later...

I am new to mangos. This is my first time to compile it in my pc. When I try to update the databases for sqlyog, I think it is Time-consuming.

from mangos\\sql\\characters.sql

DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
 `required_10664_01_characters_arena_team_stats` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';

it shows 10664_01_characters_arena_team_stats.sql is needed. If I keep updating the sql, I have to update 10662_01_characters_item_loot.sql and so. It's not just one or two files.

Is there a way to publish as a single file like character_upate.sql which include all the neccessary sql files?

What's the reason keep it so troublesome?

Link to comment
Share on other sites

there are tons of scripts doing this work,

you can copy the files of the needed updates to a directory, (con)cat them to one file and apply this file, or so many other things to speed up this process

Edit - as the system independency is a valid point, this one should work in git-bash too: (it just needs an additional created directory "processed" where it moves files that went through without problems

#!/bin/sh

USERNAME="<username>"
PASSWORD="<userpass>"

if [ "$#" -ne "1" ]
then
 echo "call with name of database"
 exit 1
fi

DATABASE="$1"

for i in *.sql
do
 echo "Process $i"
 mysql -u$USERNAME -p$PASSWORD $DATABASE < $i

 if [ "$?" -ne "0" ]
 then
   echo "An error happened"
   exit 1
 fi

 ## Done i, mv to processed
 mv $i processed/
done
echo "all done"

Link to comment
Share on other sites

It not safe apply sql updates in brainless batch mode... to real DB data.

Main task of sql updates keep DB structure compatible with code, and only optionally if possible keep data.

In some cases just impossible convert existed data by generic rule, without additional data not included in core DB part.

In fact most safer way wait used DB release and not used sql updates directly. Ofc, 99% sql updates safe

but expected that before apply you will open unkknown new sql update and look what it do and is it safe for your DB.

I strongly against including any automation tools in mangos repo for this by provided reasons.

Link to comment
Share on other sites

I got the point.

Safty is more important.

:cool:

thanks for replying,

using script is good, it's easy than a short code( some time ).

:( I always think doing a task for more than 3 times is too heavy for me~~~. In fact update db just spend me a few minutes,

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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