
CREATE TABLE tips (
    tipID               INT          NOT NULL AUTO_INCREMENT,
    sportID             INT          NOT NULL,
    strategyID          INT          NOT NULL,
    matchID             VARCHAR(255) NOT NULL, -- flashscore
    tipTime             INT          NOT NULL,    
    champID             VARCHAR(255) NOT NULL,
    champName           VARCHAR(255) NOT NULL, 
    matchName           VARCHAR(255) NOT NULL,
    market              INT          NOT NULL,
    side                INT          NOT NULL,
    param               VARCHAR(255) NOT NULL,
    price               DOUBLE       NOT NULL,
    currentMatchTime    INT          NOT NULL,
    notes               TEXT         NOT NULL, -- formatted json
    result              VARCHAR(255) NOT NULL,
    status              INT          NOT NULL, -- won, lost, void
    onexbetStatsMatchID VARCHAR(255) NOT NULL, -- for inplay tips only
    isRated             BOOL         NOT NULL,
    isTeamsSwapped      BOOL         NOT NULL,

    PRIMARY KEY(tipID)
)
ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;





CREATE TABLE markets (
    market              INT          NOT NULL AUTO_INCREMENT,    
    name                VARCHAR(255) NOT NULL,

    PRIMARY KEY(marketID)
)
ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;


CREATE TABLE sides (
    side                INT          NOT NULL AUTO_INCREMENT,    
    name                VARCHAR(255) NOT NULL,

    PRIMARY KEY(side)
)
ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;


CREATE TABLE sports (
    sportID             INT          NOT NULL AUTO_INCREMENT,    
    name                VARCHAR(255) NOT NULL,

    PRIMARY KEY(sportID)
)
ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE TABLE strategies (
    strategyID          INT          NOT NULL AUTO_INCREMENT,    
    name                VARCHAR(255) NOT NULL,
    sportID             INT          NOT NULL,
    notes               TEXT         NOT NULL,    

    PRIMARY KEY(strategyID)
)
ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;


--ALTER TABLE tips ADD COLUMN champID VARCHAR(255) NOT NULL;
--ALTER TABLE tips ADD COLUMN isRated BOOL NOT NULL DEFAULT false;

INSERT INTO sports VALUES (1, 'Football');
INSERT INTO sports VALUES (2, 'Handball');
INSERT INTO sports VALUES (3, 'Tennis');
INSERT INTO sports VALUES (4, 'Hockey');
INSERT INTO sports VALUES (5, 'Basketball');


INSERT INTO strategies VALUES (1, 'H1 Over 0.5', 1, '');
INSERT INTO strategies VALUES (2, 'FT Over 0.5', 1, '');
INSERT INTO strategies VALUES (3, 'FT Over 1.5', 1, '');
INSERT INTO strategies VALUES (6, 'H1 Over 0.5 M', 1, '');
INSERT INTO strategies VALUES (7, 'FT Over 0.5 M', 1, '');
INSERT INTO strategies VALUES (8, 'FT Over 1.5 M', 1, '');

INSERT INTO strategies VALUES (4, 'FT Over (-8, 5 min)', 2, '');
INSERT INTO strategies VALUES (5, 'FT Under (+8, 5 min)', 2, '');
INSERT INTO strategies VALUES (9, 'FT Over (-6, 10 min)', 2, '');
INSERT INTO strategies VALUES (10, 'FT Under (+6, 10 min)', 2, '');
INSERT INTO strategies VALUES (11, 'P1 Over (-4, 5 min)', 2, '');
INSERT INTO strategies VALUES (12, 'P1 Under (+4, 5 min)', 2, '');
INSERT INTO strategies VALUES (13, 'P1 Over (-5, 5 min)', 2, '');
INSERT INTO strategies VALUES (14, 'P1 Under (+5, 5 min)', 2, '');


ALTER TABLE tips ADD COLUMN isTeamsSwapped BOOL NOT NULL;