Aktualizovat „database.php“

dusovakr-patch-1
dusovakr 3 weeks ago
parent 6c5972742d
commit 7ff403664b

@ -95,22 +95,30 @@ class Database {
}
$bookrecordsTableQuery = "CREATE TABLE IF NOT EXISTS BookRecords (
Record_ID INT AUTO_INCREMENT PRIMARY KEY,
Journal_ID INT NOT NULL,
Author VARCHAR(128) NOT NULL,
Name VARCHAR(128) NOT NULL,
Length INT NOT NULL,
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,
Placement TINYINT NULL,
Placement2month TINYINT NULL,
Placement_Semifinals TINYINT NULL,
Placement_Finals TINYINT NULL,
Winner TINYINT NULL,
FOREIGN KEY (Journal_ID) REFERENCES Journal(Journal_ID) ON DELETE CASCADE
) ENGINE=InnoDB;";
Record_ID INT AUTO_INCREMENT PRIMARY KEY,
Journal_ID INT NOT NULL,
User_ID INT NOT NULL,
Author VARCHAR(128) NOT NULL,
Name VARCHAR(128) NOT NULL,
Length INT NOT NULL,
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,
Placement TINYINT NULL,
Placement2month TINYINT NULL,
Placement_Semifinals TINYINT NULL,
Placement_Finals TINYINT NULL,
Winner TINYINT NULL,
FOREIGN KEY (Journal_ID) REFERENCES Journal(Journal_ID) ON DELETE CASCADE,
FOREIGN KEY (User_ID) REFERENCES Users(User_ID) ON DELETE CASCADE
) ENGINE=InnoDB;";
if (!$this->connection->query($BookRecordsTableQuery)) {
die("Failed to create bookrecords table: " . $this->connection->error);

Loading…
Cancel
Save