Skip to content

Commit

Permalink
Gradebook: extra_credit field doesn't need to be nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
adia committed Nov 19, 2024
1 parent 52b8c30 commit 7b0751f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions install/install_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@
profesNum int(11) NOT NULL default 0,
studNum int(11) NOT NULL default 0,
visitorsNum int(11) NOT NULL default 0,
coursNum int(11) NOT NULL default 0,
coursNum int(11) NOT NULL default 0,
PRIMARY KEY (id)) $tbl_options");

$db->query("CREATE TABLE IF NOT EXISTS `document` (
Expand Down Expand Up @@ -941,7 +941,7 @@
`visible` int(11) NOT NULL,
PRIMARY KEY (`id`)) $tbl_options");

$db->query("INSERT INTO `homepagePriorities` (`title`, `order`, `visible`) VALUES
$db->query("INSERT INTO `homepagePriorities` (`title`, `order`, `visible`) VALUES
('announcements', 0, 1),
('popular_courses', 1, 1),
('texts', 2, 1),
Expand Down Expand Up @@ -1262,7 +1262,7 @@
$db->query("CREATE TABLE IF NOT EXISTS `exercise_question` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`course_id` INT(11) NOT NULL,
`question` TEXT,
`question` TEXT,
`description` TEXT,
`feedback` TEXT,
`weight` FLOAT(11,2) DEFAULT NULL,
Expand Down Expand Up @@ -1849,7 +1849,7 @@
`module_auto_type` TINYINT(4) NOT NULL DEFAULT 0,
`auto` TINYINT(4) NOT NULL DEFAULT 0,
`visible` TINYINT(4) NOT NULL DEFAULT 0,
`extra_credit` BOOL DEFAULT 0 NULL) $tbl_options");
`extra_credit` BOOL DEFAULT 0 NOT NULL) $tbl_options");

$db->query("CREATE TABLE IF NOT EXISTS `gradebook_book` (
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
Expand Down Expand Up @@ -2316,17 +2316,17 @@
FOREIGN KEY (request_id) REFERENCES request(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE) $tbl_options");

$db->query("CREATE TABLE `user_settings` (
`setting_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`course_id` int(11) DEFAULT NULL,
`value` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`setting_id`,`user_id`),
KEY `user_id` (`user_id`),
KEY `course_id` (`course_id`),
CONSTRAINT `user_settings_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_settings_ibfk_4` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
$db->query("CREATE TABLE `user_settings` (
`setting_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`course_id` int(11) DEFAULT NULL,
`value` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`setting_id`,`user_id`),
KEY `user_id` (`user_id`),
KEY `course_id` (`course_id`),
CONSTRAINT `user_settings_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `user_settings_ibfk_4` FOREIGN KEY (`course_id`) REFERENCES `course` (`id`)
ON DELETE CASCADE ON UPDATE CASCADE ) $tbl_options");

// learning analytics
Expand Down Expand Up @@ -2477,7 +2477,7 @@
`Institution` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
`School` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
`Department` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL,
`Comment` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL)
`Comment` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci DEFAULT NULL)
$tbl_options");

$db->query("CREATE TABLE `minedu_department_association` (
Expand Down
4 changes: 2 additions & 2 deletions upgrade/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2850,7 +2850,7 @@ function upgrade_to_4_0($tbl_options): void {
`order` int(11) NOT NULL,
PRIMARY KEY (`id`)) $tbl_options");

Database::get()->query("INSERT INTO `homepagePriorities` (`title`, `order`) VALUES
Database::get()->query("INSERT INTO `homepagePriorities` (`title`, `order`) VALUES
('announcements', 0),
('popular_courses', 1),
('texts', 2),
Expand Down Expand Up @@ -2903,7 +2903,7 @@ function upgrade_to_4_0($tbl_options): void {
}

if (!DBHelper::fieldExists('gradebook_activities', 'extra_credit')) {
Database::get()->query("ALTER TABLE gradebook_activities ADD extra_credit BOOL DEFAULT 0 NULL");
Database::get()->query("ALTER TABLE gradebook_activities ADD extra_credit BOOL DEFAULT 0 NOT NULL");
}

if (!DBHelper::indexExists('attendance_book', 'attendance_activity_uid')) {
Expand Down

0 comments on commit 7b0751f

Please sign in to comment.