Changes between Version 10 and Version 11 of TracTicketsCustomFields


Ignore:
Timestamp:
22/06/2017 14:04:03 (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracTicketsCustomFields

    v10 v11  
    151151you would use '''lowercase''' in the SQL: `AND c.name = 'progress_type'`.
    152152
    153 === Updating the database
    154 
    155 As noted above, any tickets created before a custom field has been defined will not have a value for that field. Here is some SQL (tested with SQLite) that you can run directly on the Trac database to set an initial value for custom ticket fields. It inserts the default value of 'None' into a custom field called 'request_source' for all tickets that have no existing value:
    156 
    157 {{{#!sql
    158 INSERT INTO ticket_custom
    159    (ticket, name, value)
    160    SELECT
    161       id AS ticket,
    162       'request_source' AS name,
    163       'None' AS value
    164    FROM ticket
    165    WHERE id NOT IN (
    166       SELECT ticket FROM ticket_custom
    167    );
    168 }}}
    169 
    170 If you added multiple custom fields at different points in time, you should be more specific in the subquery on table {{{ticket}}} by adding the exact custom field name to the query:
    171 
    172 {{{#!sql
    173 INSERT INTO ticket_custom
    174    (ticket, name, value)
    175    SELECT
    176       id AS ticket,
    177       'request_source' AS name,
    178       'None' AS value
    179    FROM ticket
    180    WHERE id NOT IN (
    181       SELECT ticket FROM ticket_custom WHERE name = 'request_source'
    182    );
    183 }}}
    184 
    185153----
    186154See also: TracTickets, TracIni