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_player_1" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("home_player_1") REFERENCES "Player"("player_api_id")
);

CREATE TABLE "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_api_id" INT,
"date" TEXT,
"overall_rating" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Ariel Borysiuk");
INSERT INTO "Player" VALUES ("2", "1002", "Paulin Puel");
INSERT INTO "Player" VALUES ("3", "1003", "Lionel Messi");
INSERT INTO "Player" VALUES ("4", "1004", "Cristiano Ronaldo");
INSERT INTO "Player" VALUES ("5", "1005", "Neymar Jr.");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2015-01-01", "75");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "2015-01-01", "60");
INSERT INTO "Player_Attributes" VALUES ("3", "1001", "2016-01-01", "78");
INSERT INTO "Player_Attributes" VALUES ("4", "1002", "2016-01-01", "62");
INSERT INTO "Player_Attributes" VALUES ("5", "1003", "2015-01-01", "95");
INSERT INTO "Player_Attributes" VALUES ("6", "1004", "2015-01-01", "93");
INSERT INTO "Player_Attributes" VALUES ("7", "1005", "2015-01-01", "90");
INSERT INTO "Player_Attributes" VALUES ("8", "1001", "2014-01-01", "70");
INSERT INTO "Player_Attributes" VALUES ("9", "1002", "2014-01-01", "55");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1003");
INSERT INTO "Match" VALUES ("4", "1004");
INSERT INTO "Match" VALUES ("5", "1005");
INSERT INTO "Team" VALUES ("1", "FC Barcelona");
INSERT INTO "Team" VALUES ("2", "Real Madrid");
INSERT INTO "Team" VALUES ("3", "Paris Saint-Germain");
INSERT INTO "Team" VALUES ("4", "Lech Poznan");
INSERT INTO "Team" VALUES ("5", "OGC Nice");