Just adding a link

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

This reports contains some (older) discussions on this topic.

Note that timestamps are not per se updated automatically.



Van: koha-devel-bounces@lists.koha-community.org <koha-devel-bounces@lists.koha-community.org> namens David Cook <dcook@prosentient.com.au>
Verzonden: dinsdag 31 mei 2016 07:21:17
Aan: koha-devel@lists.koha-community.org
Onderwerp: [Koha-devel] SQL92 keywords and naming columns
 

I was wondering if we have any advice for naming columns, especially TIMESTAMP columns, so I looked on the wiki and found that we’re not supposed to use SQL92 keywords: https://wiki.koha-community.org/wiki/Coding_Guidelines#SQL2:_SQL92_keywords

 

I’m not super familiar with all the keywords, but I’m confident that “timestamp” is one of those keywords. Here’s the distribution on a dev Koha I have:

 

'created', 1

'created_on', 2

'date', 1

'dateadded', 1

'date_uploaded', 2

'dtcreated', 1

'lastmodified', 1

'message_date', 1

'modification_time', 1

'needed', 1

'time', 2

'timestamp', 26

'time_queued', 1

'updated', 1

'upload_timestamp', 2

'validated', 1

'valid_until', 1

 

I thought I’d check out DATETIME as well. Interestingly, there is a DATETIME column named “timestamp” as well:

 

'datearrived', 1

'datereviewed', 1

'datesent', 1

'datetime', 1

'date_approved', 1

'date_created', 3

'date_due', 2

'date_modified', 1

'date_run', 1

'issuedate', 2

'itemlost_on', 2

'lastreneweddate', 2

'last_modified', 1

'last_run', 1

'returndate', 2

'sharedate', 1

'start_time', 1

'suspend_until', 2

'timeclicked', 1

'timestamp', 1

'withdrawn_on', 2

 

It seems undesirable to use timestamp for things like “upload_timestamp” and “message_date” as well, as TIMESTAMP will automatically update when that row is updated as per these conditions: http://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html.

 

Anyway, something to think about…

 

 

David Cook

Systems Librarian

 

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

 

Office: 02 9212 0899

Direct: 02 8005 0595