View Ticket
Not logged in
Ticket UUID: d0e0bc0da5dc63187fc64643ff1ce391a02e6237
Title: add ticket created time
Status: Open Type: Feature_Request
Severity: Minor Priority:
Subsystem: Resolution: Works_As_Designed
Last Modified: 2009-12-31 21:15:45
Version Found In:
ticket schema has tkt_mtime but there is no column which saves the creation time. this would be useful for ordering tickets by open time or by time since last edited. this might be possible using the current ticket configuration but I think it is more appropriate to have a tkt_ctime column that is managed automatically.

anonymous claiming to be Kees Nuyt added on 2008-11-27 23:09:31:
Initially I agreed, but considering that tickets are stored with full history (*), and there is a history button, there is no real need for a tkt_ctime column. If you really want one: you can change the ticket table to your liking in Setup, and use any columns in ticket reports.

(*) I seem to have read the current status is obtained by replaying all ticket updates in chronological order, where the newer value replaces an old one, and comments are appended to form the text blocks at the bottom of the ticket detail page.

jeremy_c added on 2009-12-31 03:57:22:
I believe you can simply add a column to your ticket schema:

create_date datetime default CURRENT_TIMESTAMP

jeremy_c added on 2009-12-31 04:26:49:
Yes, the code above works just fine.

rwilson added on 2009-12-31 19:42:25:
actually, i just tested the schema changes solution above; editing a ticket updates the created time. this is because, essentially, editing a ticket performs a DELETE then an INSERT, so the default CURRENT_DATETIME gets evaluated fresh again. (i confirmed this by inspecting tkt.c [98960a5cdc].)

i'm not sure that the OP's request can be resolved without writing some fossil code. i'm going to try a few more things with the ui to see if i can get the desired result, but i don't have any more time today.

jeremy_c added on 2009-12-31 21:15:45:
You are right. I wanted to implement this in my own repo, so I added some code and tested. This method works :-)

Add to your database schema something like:

create_date TEXT

Then in your New Ticket template, add something like:

  if {[info exists submit]} {
     set create_date [date]

You likely already have the above if statement and only need to add the set create_date part. You can then display the create date in your View template.

Sorry for the bum fix to start with. I made a simple test case and didn't test editing.