Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--
-- Modifications to table `search`
--

ALTER TABLE "search"
ALTER COLUMN saved DROP DEFAULT,
ALTER COLUMN saved TYPE boolean USING saved::boolean,
ALTER COLUMN saved SET NOT NULL,
ALTER COLUMN saved SET DEFAULT '0';
--
-- Modifications to table `user_list`
--

ALTER TABLE "user_list"
ALTER COLUMN public DROP DEFAULT,
ALTER COLUMN public TYPE boolean USING public::boolean,
ALTER COLUMN public SET NOT NULL,
ALTER COLUMN public SET DEFAULT '0';
4 changes: 2 additions & 2 deletions module/VuFind/sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ CREATE TABLE `search` (
`folder_id` int(11) DEFAULT NULL,
`created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
`title` varchar(20) DEFAULT NULL,
`saved` int(1) NOT NULL DEFAULT '0',
`saved` tinyint(1) NOT NULL DEFAULT '0',
`search_object` blob,
`checksum` int(11) DEFAULT NULL,
`notification_frequency` int(11) NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -265,7 +265,7 @@ CREATE TABLE `user_list` (
`title` varchar(200) NOT NULL,
`description` text,
`created` datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
`public` int(11) NOT NULL DEFAULT '0',
`public` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `user_list_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
Expand Down
4 changes: 2 additions & 2 deletions module/VuFind/sql/pgsql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ session_id varchar(128),
folder_id int DEFAULT NULL,
created timestamp NOT NULL DEFAULT '1970-01-01 00:00:00',
title varchar(20) DEFAULT NULL,
saved int NOT NULL DEFAULT '0',
saved boolean NOT NULL DEFAULT '0',
search_object bytea,
checksum int DEFAULT NULL,
notification_frequency int NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -192,7 +192,7 @@ user_id int NOT NULL,
title varchar(200) NOT NULL,
description text DEFAULT NULL,
created timestamp NOT NULL DEFAULT '1970-01-01 00:00:00',
public int NOT NULL DEFAULT '0',
public boolean NOT NULL DEFAULT '0',
PRIMARY KEY (id)
);
CREATE INDEX user_list_user_id_idx ON user_list (user_id);
Expand Down
4 changes: 3 additions & 1 deletion module/VuFind/src/VuFind/Controller/MyResearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ protected function isDuplicateOfSavedSearch(
$userId
);
foreach ($matches as $current) {
if ($current->saved === 1 && $current->id !== $rowToCheck->id) {
// $current->saved may be 1 (MySQL) or true (PostgreSQL), so we should
// avoid a strict === comparison here:
if ($current->saved == 1 && $current->id !== $rowToCheck->id) {
return $current->id;
}
}
Expand Down
2 changes: 2 additions & 0 deletions module/VuFind/src/VuFind/Search/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public function getSearchHistory($userId = null)
$saved = $schedule = $unsaved = [];
foreach ($searchHistory as $current) {
$search = $current->getSearchObject()->deminify($this->resultsManager);
// $current->saved may be 1 (MySQL) or true (PostgreSQL), so we should
// avoid a strict === comparison here:
if ($current->saved == 1) {
$saved[] = $search;
} else {
Expand Down