#---------------
# Author: Yomara Acevedo
# Date: 29 Apr 2017
# Purpose: Create tables into dB
#---------------

#---------------
# Create tables in database "SuddenDeath.db"
#---------------

import json
import sqlite3

DB_Name = "SuddenDeath.db"

conn = sqlite3.connect(DB_Name)

c = conn.cursor()

c.execute('''DROP TABLE if exists suddeath_master;''')
c.execute('''DROP TABLE if exists suddeath_P1;''')
c.execute('''DROP TABLE if exists suddeath_P2;''')

c.execute('''CREATE TABLE suddeath_master
                (date_n_time, gameinfo_Stage, gameinfo_Time, P1_characterID, P2_characterID,
                P1_rolls, P2_rolls, P1_dodges, P2_dodges,
                P1_apm, P2_apm, P1_avg_death, P2_avg_death, P1_avg_combo_dmg, P2_avg_combo_dmg,
                P1_hits_p_combo, P2_hits_p_combo, P1_edge_guard_eff, P2_edge_guard_eff)''')

c.execute('''CREATE TABLE suddeath_P1
                (date_n_time, gameinfo_Stage, gameinfo_Time, P1_characterID,
                P1_rolls, P1_dodges,
                P1_apm, P1_avg_death, P1_avg_combo_dmg,
                P1_hits_p_combo, P1_edge_guard_eff)''')

c.execute('''CREATE TABLE suddeath_P2
                (date_n_time, gameinfo_Stage, gameinfo_Time, P2_characterID,
                P2_rolls, P2_dodges,
                P2_apm, P2_avg_death, P2_avg_combo_dmg,
                P2_hits_p_combo, P2_edge_guard_eff)''')

conn.commit()

conn.close()
