# this file determines the layout of the PvPGN SQL database
# the server will create the tables with their columns as specified in here
# don't forget to create the DB yourself
# no empty lines allowed, no whitespaces in front of any entries allowed
# file format:
# [name_of_a_table]
# "column_name with format infos","default value" [&& "sqlcommand to execute on success"] [|| "sqlcommand to execute on failure"]
# :"sqlcommand to execute" [&& "sqlcommand to execute on success"] [|| "sqlcommand to execute on failure"]
# you might also notice some variables of the form ${variable}. these are 
# replaced with their meaning when the server starts
# ${prefix} is replaced with the configured table prefix from bnetd.conf/storage_path
#
# For the "sql" SQL layout
#
[${prefix}BNET]
"uid int NOT NULL PRIMARY KEY","'0'"
"acct_username varchar(32)","NULL"
"username varchar(32)","NULL" && "UPDATE ${prefix}BNET SET username = lower(acct_username)"
"acct_userid int","NULL"
"acct_passhash1 varchar(128)","NULL"
"acct_email varchar(128)","NULL"
"auth_admin varchar(16)","'false'"
"auth_normallogin varchar(16)","'true'"
"auth_changepass varchar(16)","'true'"
"auth_changeprofile varchar(16)","'true'"
"auth_botlogin varchar(16)","'true'"
"auth_operator varchar(16)","'false'"
"new_at_team_flag int","'0'"
"auth_lockk varchar(16)","'0'"
"auth_mute varchar(16)","'0'"
"auth_command_groups varchar(128)","'1'"
"acct_lastlogin_time int","'0'"
"acct_lastlogin_owner varchar(128)","NULL"
"acct_lastlogin_clienttag varchar(128)","NULL"
"acct_lastlogin_ip varchar(32)","NULL"
:"DROP INDEX username"
:"CREATE UNIQUE INDEX username2 ON ${prefix}BNET (username)"
[${prefix}WOL]
"uid int NOT NULL PRIMARY KEY","'0'"
"auth_apgar varchar(8)","NULL"
"acct_locale int","'0'"
[${prefix}friend]
"uid int NOT NULL PRIMARY KEY","'0'"
[${prefix}profile]
"uid int NOT NULL PRIMARY KEY","'0'"
"sex varchar(16)","NULL"
"location varchar(128)","NULL"
"description varchar(256)","NULL"
"age varchar(16)","NULL"
"clanname varchar(48)","NULL"
[${prefix}Record]
"uid int NOT NULL PRIMARY KEY","'0'"
"WAR3_solo_xp int","'0'"
"WAR3_solo_level int","'0'"
"WAR3_solo_wins int","'0'"
"WAR3_solo_rank int","'0'"
"WAR3_solo_losses int","'0'"
"WAR3_team_xp int","'0'"
"WAR3_team_level int","'0'"
"WAR3_team_rank int","'0'"
"WAR3_team_wins int","'0'"
"WAR3_team_losses int","'0'"
"WAR3_ffa_xp int","'0'"
"WAR3_ffa_rank int","'0'"
"WAR3_ffa_level int","'0'"
"WAR3_ffa_wins int","'0'"
"WAR3_ffa_losses int","'0'"
"WAR3_orcs_wins int","'0'"
"WAR3_orcs_losses int","'0'"
"WAR3_humans_wins int","'0'"
"WAR3_humans_losses int","'0'"
"WAR3_undead_wins int","'0'"
"WAR3_undead_losses int","'0'"
"WAR3_nightelves_wins int","'0'"
"WAR3_nightelves_losses int","'0'"
"WAR3_random_wins int","'0'"
"WAR3_random_losses int","'0'"
"WAR3_teamcount int","'0'"
"WAR3_userselected_icon varchar(16)","NULL"
"W3XP_solo_xp int","'0'"
"W3XP_solo_level int","'0'"
"W3XP_solo_wins int","'0'"
"W3XP_solo_rank int","'0'"
"W3XP_solo_losses int","'0'"
"W3XP_team_xp int","'0'"
"W3XP_team_level int","'0'"
"W3XP_team_rank int","'0'"
"W3XP_team_wins int","'0'"
"W3XP_team_losses int","'0'"
"W3XP_ffa_xp int","'0'"
"W3XP_ffa_rank int","'0'"
"W3XP_ffa_level int","'0'"
"W3XP_ffa_wins int","'0'"
"W3XP_ffa_losses int","'0'"
"W3XP_orcs_wins int","'0'"
"W3XP_orcs_losses int","'0'"
"W3XP_humans_wins int","'0'"
"W3XP_humans_losses int","'0'"
"W3XP_undead_wins int","'0'"
"W3XP_undead_losses int","'0'"
"W3XP_nightelves_wins int","'0'"
"W3XP_nightelves_losses int","'0'"
"W3XP_random_wins int","'0'"
"W3XP_random_losses int","'0'"
"W3XP_teamcount int","'0'"
"W3XP_userselected_icon varchar(16)","NULL"
"STAR_0_wins int","'0'"
"STAR_0_losses int","'0'"
"STAR_0_disconnects int","'0'"
"STAR_1_wins int","'0'"
"STAR_1_losses int","'0'"
"STAR_1_disconnects int","'0'"
"STAR_0_last_game int","'0'"
"STAR_0_last_game_result varchar(128)","NULL"
"STAR_1_last_game int","'0'"
"STAR_1_last_game_result varchar(128)","NULL"
"STAR_1_rating int","'0'"
"STAR_1_high_rating int","'0'"
"STAR_1_rank int","'0'"
"STAR_1_high_rank int","'0'"
"SEXP_0_wins int","'0'"
"SEXP_0_losses int","'0'"
"SEXP_0_disconnects int","'0'"
"SEXP_1_wins int","'0'"
"SEXP_1_losses int","'0'"
"SEXP_1_disconnects int","'0'"
"SEXP_0_last_game int","'0'"
"SEXP_0_last_game_result varchar(128)","NULL"
"SEXP_1_last_game int","'0'"
"SEXP_1_last_game_result varchar(128)","NULL"
"SEXP_1_rating int","'0'"
"SEXP_1_high_rating int","'0'"
"SEXP_1_rank int","'0'"
"SEXP_1_high_rank int","'0'"
"TSUN_solo_rank int","'0'"
"TSUN_solo_points int","'0'"
"TSUN_solo_wins int","'0'"
"TSUN_solo_losses int","'0'"
"TSUN_solo_disconnects int","'0'"
"TSXP_solo_rank int","'0'"
"TSXP_solo_points int","'0'"
"TSXP_solo_wins int","'0'"
"TSXP_solo_losses int","'0'"
"TSXP_solo_disconnects int","'0'"
"RAL2_solo_rank int","'0'"
"RAL2_solo_points int","'0'"
"RAL2_solo_wins int","'0'"
"RAL2_solo_losses int","'0'"
"RAL2_solo_disconnects int","'0'"
"YURI_solo_rank int","'0'"
"YURI_solo_points int","'0'"
"YURI_solo_wins int","'0'"
"YURI_solo_losses int","'0'"
"YURI_solo_disconnects int","'0'"
[${prefix}clan]
"cid int NOT NULL PRIMARY KEY","'0'"
"short int","'0'"
"name varchar(32)","NULL"
"motd varchar(255)","NULL",
"creation_time int","'0'"
[${prefix}clanmember]
"uid int NOT NULL PRIMARY KEY","'0'"
"cid int","'0'"
"status int","'0'"
"join_time int","'0'"
[${prefix}arrangedteam]
"teamid int NOT NULL PRIMARY KEY","'0'"
"size int","0"
"clienttag varchar(8)","NULL"
"lastgame int","'0'"
"member1 int","'0'"
"member2 int","'0'"
"member3 int","'0'"
"member4 int","'0'"
"wins int","'0'"
"losses int","'0'"
"xp int","'0'"
"level int","'0'"
"rank int","'0'"
