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

CREATE TABLE "Match" (
"id" INT,
"country_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("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,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);



INSERT INTO "Country" VALUES ("1", "Belgium");
INSERT INTO "Country" VALUES ("2", "France");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "Country" VALUES ("4", "UnknownLand");
INSERT INTO "Match" VALUES ("1", "1");
INSERT INTO "Match" VALUES ("2", "2");
INSERT INTO "Match" VALUES ("3", "3");
INSERT INTO "Player" VALUES ("1", "1001", "Kevin De Bruyne", "5001");
INSERT INTO "Player" VALUES ("2", "1002", "Eden Hazard", "5002");
INSERT INTO "Player" VALUES ("3", "1003", "Kylian Mbappe", "5003");
INSERT INTO "Player" VALUES ("4", "1004", "Thomas Muller", "5004");
INSERT INTO "Player" VALUES ("5", "1005", "Unknown Player", "5005");
INSERT INTO "Player" VALUES ("6", "1006", "Dual National Player", "5006");
INSERT INTO "Player_Attributes" VALUES ("10010 + 1", "1001");
INSERT INTO "Player_Attributes" VALUES ("10020 + 1", "1002");
INSERT INTO "Player_Attributes" VALUES ("10030 + 2", "1003");
INSERT INTO "Player_Attributes" VALUES ("10040 + 3", "1004");
INSERT INTO "Player_Attributes" VALUES ("10050 + 4", "1005");
INSERT INTO "Player_Attributes" VALUES ("10060 + 1", "1006");
INSERT INTO "Player_Attributes" VALUES ("10060 + 2", "1006");