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,
"player_fifa_api_id" INT UNIQUE,
PRIMARY KEY ("id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Francesco Parravicini", "12345");
INSERT INTO "Player" VALUES ("2", "1002", "Lionel Messi", "67890");
INSERT INTO "Player" VALUES ("3", "1003", "Cristiano Ronaldo", "11223");
INSERT INTO "Player" VALUES ("4", "1004", "Neymar Jr.", "44556");
INSERT INTO "Player" VALUES ("5", "1005", "Kylian Mbappe", "77889");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2010-08-30 00:00:00", "75", "80");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2011-01-01 00:00:00", "76", "81");
INSERT INTO "Player_Attributes" VALUES ("3", "1002", "2010-08-30 00:00:00", "92", "95");
INSERT INTO "Player_Attributes" VALUES ("4", "1003", "2010-08-30 00:00:00", "90", "93");
INSERT INTO "Player_Attributes" VALUES ("5", "1001", "2009-07-15 00:00:00", "70", "75");
INSERT INTO "Player_Attributes" VALUES ("6", "1004", "2010-08-30 00:00:00", "85", "90");
INSERT INTO "Player_Attributes" VALUES ("7", "1001", "2010-09-15 00:00:00", "75", "80");
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");