Add database schema and relocate database to seperate directory
This commit is contained in:
parent
786f03d2e5
commit
5f300cc7ed
@ -26,7 +26,7 @@ int main(int argc, char* argv[]) {
|
||||
char *zErrMsg = 0;
|
||||
int rc;
|
||||
|
||||
rc = sqlite3_open("../trivia.db", &db);
|
||||
rc = sqlite3_open("../db/trivia.db", &db);
|
||||
|
||||
if (rc) {
|
||||
std::cerr << "Can't open database: " << sqlite3_errmsg(db) << std::endl;
|
||||
|
13
TriviaBot/db/schema.sqlite
Normal file
13
TriviaBot/db/schema.sqlite
Normal 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;
|
Loading…
Reference in New Issue
Block a user