Add database schema and relocate database to seperate directory

This commit is contained in:
Jack Bond-Preston 2016-06-20 16:59:15 +01:00
parent 786f03d2e5
commit 5f300cc7ed
3 changed files with 14 additions and 1 deletions

View File

@ -26,7 +26,7 @@ int main(int argc, char* argv[]) {
char *zErrMsg = 0; char *zErrMsg = 0;
int rc; int rc;
rc = sqlite3_open("../trivia.db", &db); rc = sqlite3_open("../db/trivia.db", &db);
if (rc) { if (rc) {
std::cerr << "Can't open database: " << sqlite3_errmsg(db) << std::endl; std::cerr << "Can't open database: " << sqlite3_errmsg(db) << std::endl;

View File

@ -0,0 +1,13 @@
BEGIN TRANSACTION;
CREATE TABLE `TotalScores` (
`User` TEXT UNIQUE,
`TotalScore` INTEGER,
PRIMARY KEY(User)
);
CREATE TABLE "Questions" (
`ID` INTEGER PRIMARY KEY AUTOINCREMENT,
`Category` TEXT,
`Question` TEXT,
`Answer` TEXT
);
COMMIT;