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 "Match" (
"id" INT,
"home_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("home_team_api_id") REFERENCES "Team"("team_api_id")
);

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

CREATE TABLE "Team_Attributes" (
"id" INT,
"team_api_id" INT,
"date" TEXT,
"buildUpPlaySpeed" INT,
"buildUpPlaySpeedClass" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("team_api_id") REFERENCES "Team"("team_api_id")
);



INSERT INTO "Team" VALUES ("1", "1000", "Willem II", "WIL");
INSERT INTO "Team" VALUES ("2", "1001", "Ajax", "AJX");
INSERT INTO "Team" VALUES ("3", "1002", "PSV Eindhoven", "PSV");
INSERT INTO "Team" VALUES ("4", "1003", "Feyenoord", "FEY");
INSERT INTO "Team" VALUES ("5", "1004", "FC Utrecht", "UTR");
INSERT INTO "Team_Attributes" VALUES ("1", "1000", "2011-02-22", "50", "Fast");
INSERT INTO "Team_Attributes" VALUES ("2", "1000", "2012-02-22", "60", "Normal");
INSERT INTO "Team_Attributes" VALUES ("3", "1001", "2011-02-22", "70", "Fast");
INSERT INTO "Team_Attributes" VALUES ("4", "1002", "2011-02-22", "40", "Slow");
INSERT INTO "Team_Attributes" VALUES ("5", "1000", "2013-02-22", "55", "Normal");
INSERT INTO "Team_Attributes" VALUES ("6", "1000", "2011-03-01", "52", "Fast");
INSERT INTO "Team_Attributes" VALUES ("7", "1000", "2010-02-22", "45", "Slow");
INSERT INTO "Match" VALUES ("1", "1000");
INSERT INTO "Match" VALUES ("2", "1001");
INSERT INTO "Match" VALUES ("3", "1002");
INSERT INTO "Match" VALUES ("4", "1003");
INSERT INTO "Match" VALUES ("5", "1004");