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 "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
"player_fifa_api_id" INT UNIQUE,
"birthday" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_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"),
FOREIGN KEY ("player_fifa_api_id") REFERENCES "Player"("player_fifa_api_id")
);

CREATE TABLE "Team_Attributes" (
"id" INT,
"date" TEXT,
PRIMARY KEY ("id")
);



INSERT INTO "Player" VALUES ("1", "101", "Landon Donovan", "1001", "1982-03-04");
INSERT INTO "Player" VALUES ("2", "102", "Jordan Bowery", "1002", "1991-01-02");
INSERT INTO "Player" VALUES ("3", "103", "Other Player", "1003", "1990-05-10");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "101", "2013/7/12", "85", "88");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "102", "2013/7/12", "75", "80");
INSERT INTO "Player_Attributes" VALUES ("3", "1003", "103", "2013/7/12", "70", "75");
INSERT INTO "Team_Attributes" VALUES ("1", "2013/7/12");
INSERT INTO "Team_Attributes" VALUES ("2", "2013/7/13");