[Koha-bugs] [Bug 10459] borrowers should have a timestamp

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 21 14:37:18 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10459

--- Comment #29 from M. Tompsett <mtompset at hotmail.com> ---
(In reply to Marcel de Rooy from comment #27)
> Thanks for reviving this.
> The reason I left this pending however, is probably as valid as then.
> If you call the field timestamp, we will have clashes in SQL joins here and
> there in the codebase where another table also has the same field timestamp.
> Especially think about the SELECT * statements with timestamp in another
> clause as well. So to prevent the ambiguous column name errors, we need to
> track these cases, test.. and hope we found them all.
> An older alternative to add bortimestamp, introducing a new name, did not
> meet much approval.

The problem is there are so many already with timestamp, I was thinking a
"rename the timestamp fields" bug would be a reasonable next step. I don't see
an immediate need to push this through right now. If there is a this bug blocks
that renaming bug, that would be a good next step.

Part of the discussion needs to be how to name timestamps.
Because while thinking about that very problem, I found:
DROP TABLE IF EXISTS `borrower_debarments`;
CREATE TABLE borrower_debarments ( -- tracks restrictions on the patron's
record
  borrower_debarment_id int(11) NOT NULL AUTO_INCREMENT, -- unique key for the
restriction
  borrowernumber int(11) NOT NULL, -- foreign key for borrowers.borrowernumber
for patron who is restricted
  expiration date DEFAULT NULL, -- expiration date of the restriction
  `type` enum('SUSPENSION','OVERDUES','MANUAL','DISCHARGE') NOT NULL DEFAULT
'MANUAL', -- type of restriction
  `comment` text, -- comments about the restriction
  manager_id int(11) DEFAULT NULL, -- foreign key for borrowers.borrowernumber
for the librarian managing the restriction
  created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP, -- date the restriction was added
  updated timestamp NULL DEFAULT NULL, -- date the restriction was updated
  PRIMARY KEY (borrower_debarment_id),
  KEY borrowernumber (borrowernumber),
  CONSTRAINT `borrower_debarments_ibfk_1` FOREIGN KEY (`borrowernumber`)
REFERENCES `borrowers` (`borrowernumber`)
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

I think there is a logic error on the created timestamp. That is, I think the
ON UPDATE clause should be on the updated timestamp.

In short, timestamps that do exist in Koha are messy.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list