PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "League" (
"id" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Match" (
"id" INT,
"league_id" INT,
"date" TEXT,
"home_team_api_id" INT,
"away_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("id")
);

CREATE TABLE "Team" (
"id" INT,
"team_long_name" TEXT,
PRIMARY KEY ("id")
);



INSERT INTO "League" VALUES ("1", "Germany 1. Bundesliga");
INSERT INTO "League" VALUES ("2", "England Premier League");
INSERT INTO "League" VALUES ("3", "Spain La Liga");
INSERT INTO "League" VALUES ("4", "Italy Serie A");
INSERT INTO "League" VALUES ("5", "France Ligue 1");
INSERT INTO "Match" VALUES ("1", "1", "2008-08-15", "101", "102");
INSERT INTO "Match" VALUES ("2", "1", "2008-08-22", "103", "104");
INSERT INTO "Match" VALUES ("3", "1", "2008-09-05", "101", "103");
INSERT INTO "Match" VALUES ("4", "1", "2008-09-12", "102", "104");
INSERT INTO "Match" VALUES ("5", "1", "2008-10-03", "101", "104");
INSERT INTO "Match" VALUES ("6", "1", "2008-10-10", "102", "103");
INSERT INTO "Match" VALUES ("7", "1", "2008-11-01", "101", "102");
INSERT INTO "Match" VALUES ("8", "2", "2008-08-16", "201", "202");
INSERT INTO "Match" VALUES ("9", "2", "2008-09-06", "203", "204");
INSERT INTO "Match" VALUES ("10", "1", "2009-08-15", "101", "102");
INSERT INTO "Match" VALUES ("11", "1", "2008-07-30", "101", "102");
INSERT INTO "Match" VALUES ("12", "1", "2008-11-05", "103", "104");
INSERT INTO "Team" VALUES ("101", "Bayern Munich");
INSERT INTO "Team" VALUES ("102", "Borussia Dortmund");
INSERT INTO "Team" VALUES ("103", "Schalke 04");
INSERT INTO "Team" VALUES ("104", "Bayer Leverkusen");
INSERT INTO "Team" VALUES ("201", "Manchester United");
INSERT INTO "Team" VALUES ("202", "Liverpool");
INSERT INTO "Team" VALUES ("203", "Chelsea");
INSERT INTO "Team" VALUES ("204", "Arsenal");