|
|
|
@ -66,7 +66,7 @@ class Database {
|
|
|
|
|
Created_At TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
|
|
|
) ENGINE=InnoDB;";
|
|
|
|
|
|
|
|
|
|
if (!$this->connection->query($usersTableQuery)) {
|
|
|
|
|
if (!$this->connection->query($UsersTableQuery)) {
|
|
|
|
|
die("Failed to create users table: " . $this->connection->error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -78,7 +78,7 @@ class Database {
|
|
|
|
|
FOREIGN KEY (User_ID) REFERENCES Users(User_ID) ON DELETE CASCADE
|
|
|
|
|
) ENGINE=InnoDB;";
|
|
|
|
|
|
|
|
|
|
if (!$this->connection->query($usersTableQuery)) {
|
|
|
|
|
if (!$this->connection->query($JournalTableQuery)) {
|
|
|
|
|
die("Failed to create journal table: " . $this->connection->error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ class Database {
|
|
|
|
|
FOREIGN KEY (Journal_ID) REFERENCES Journal(Journal_ID) ON DELETE CASCADE
|
|
|
|
|
) ENGINE=InnoDB;";
|
|
|
|
|
|
|
|
|
|
if (!$this->connection->query($usersTableQuery)) {
|
|
|
|
|
if (!$this->connection->query($ChallengeTableQuery)) {
|
|
|
|
|
die("Failed to create challenges table: " . $this->connection->error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -100,7 +100,7 @@ class Database {
|
|
|
|
|
Author VARCHAR(128) NOT NULL,
|
|
|
|
|
Name VARCHAR(128) NOT NULL,
|
|
|
|
|
Length INT NOT NULL,
|
|
|
|
|
Status ENUM('TBR', 'Reading', 'Read'),
|
|
|
|
|
Status ENUM('TBR', 'Reading', 'Read') NOT NULL,
|
|
|
|
|
Favourite TINYINT,
|
|
|
|
|
Finished DATE NULL,
|
|
|
|
|
Genre ENUM('Adventure','Science Fiction','Fantasy','Mystery','Thriller','Horror','Romance','Historical Fiction','Dystopian','Crime','Contemporary Fiction','Magical Realism','Paranormal','Literary Fiction','True Crime','Young Adult (YA)','New Adult (NA)','Children''s Fiction','Military Fiction','Western','Coming of Age','Political Fiction','LGBTQ+ Fiction') NOT NULL,
|
|
|
|
@ -112,7 +112,7 @@ class Database {
|
|
|
|
|
FOREIGN KEY (Journal_ID) REFERENCES Journal(Journal_ID) ON DELETE CASCADE
|
|
|
|
|
) ENGINE=InnoDB;";
|
|
|
|
|
|
|
|
|
|
if (!$this->connection->query($usersTableQuery)) {
|
|
|
|
|
if (!$this->connection->query($BookRecordsTableQuery)) {
|
|
|
|
|
die("Failed to create bookrecords table: " . $this->connection->error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|