View Full Version : Combine SQL

10-05-2013, 11:01 AM
I'm just posting the code here, the original post is here : http://www.trinitycore.org/f/topic/43-windowslinux-combine-sql-updates/

Windows :
Copy/paste the below source into a new Notepad++ file and save it as "gather updates.bat" (without quotes of course, and whatever you'd like to call it)
Drop it into your main Trinity\ source directory.
After each TrinityCore update that you do, double-click this .bat file to merge the new .SQL queries into 3 organized .SQL files to easily import them into your auth/characters/world databases.

@echo off
setlocal EnableDelayedExpansion
set WorldUpdates=All_World_Updates.sql
set CharactersUpdates=All_Characters_Updates.sql
set AuthUpdates=All_Auth_Updates.sql

if exist %CharactersUpdates% del %CharactersUpdates%
if exist %AuthUpdates% del %AuthUpdates%
if exist %WorldUpdates% del %WorldUpdates%

for %%a in (sql\updates\world\*.sql) do (
echo /* >>%WorldUpdates%
echo * %%a >>%WorldUpdates%
echo */ >>%WorldUpdates%
copy/b %WorldUpdates%+"%%a" %WorldUpdates%
echo. >>%WorldUpdates%
echo. >>%WorldUpdates%)

for %%a in (sql\updates\characters\*.sql) do (
echo /* >>%CharactersUpdates%
echo * %%a >>%CharactersUpdates%
echo */ >>%CharactersUpdates%
copy/b %CharactersUpdates%+"%%a" %CharactersUpdates%
echo. >>%CharactersUpdates%
echo. >>%CharactersUpdates%)

for %%a in (sql\updates\auth\*.sql) do (
echo /* >>%AuthUpdates%
echo * %%a >>%AuthUpdates%
echo */ >>%AuthUpdates%
copy/b %AuthUpdates%+"%%a" %AuthUpdates%
echo. >>%AuthUpdates%
echo. >>%AuthUpdates%)

cd into your source/sql/updates directory and choose one of these options:

cat world/*.sql > all_world_updates.sql
cat characters/*.sql > all_characters_updates.sql

credits goes to Gregarious from TrinityCore

10-05-2013, 11:09 AM
Thanks Neth haha

10-05-2013, 02:42 PM
useful, thanks for sharing

10-05-2013, 06:32 PM
Thanks for sharing, Neth!

10-11-2013, 03:18 AM
Thanks for sharing :)