close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
- Timestamp:
-
Jul 14, 2008, 10:28:17 AM (16 years ago)
- Author:
-
trac
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
30 | 30 | * label: Descriptive label. |
31 | 31 | * options: List of values, separated by '''|''' (vertical pipe). |
32 | | * value: Default value (Item #, starting at 0). |
| 32 | * value: Default value (one of the values from options). |
33 | 33 | * order: Sort order placement. |
34 | 34 | * '''textarea''': Multi-line text area. |
… |
… |
|
62 | 62 | test_five.label = Radio buttons are fun |
63 | 63 | test_five.options = uno|dos|tres|cuatro|cinco |
64 | | test_five.value = 1 |
| 64 | test_five.value = dos |
65 | 65 | |
66 | 66 | test_six = textarea |
… |
… |
|
107 | 107 | Note in particular the `LEFT OUTER JOIN` statement here. |
108 | 108 | |
| 109 | === Updating the database === |
| 110 | |
| 111 | As noted above, any tickets created before a custom field has been defined will not have a value for that field. Here's a bit of SQL (tested with SQLite) that you can run directly on the Trac database to set an initial value for custom ticket fields. Inserts the default value of 'None' into a custom field called 'request_source' for all tickets that have no existing value: |
| 112 | |
| 113 | {{{ |
| 114 | #!sql |
| 115 | INSERT INTO ticket_custom |
| 116 | (ticket, name, value) |
| 117 | SELECT |
| 118 | id AS ticket, |
| 119 | 'request_source' AS name, |
| 120 | 'None' AS value |
| 121 | FROM ticket |
| 122 | WHERE id NOT IN ( |
| 123 | SELECT ticket FROM ticket_custom |
| 124 | ); |
| 125 | }}} |
| 126 | |
| 127 | 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: |
| 128 | |
| 129 | {{{ |
| 130 | #!sql |
| 131 | INSERT INTO ticket_custom |
| 132 | (ticket, name, value) |
| 133 | SELECT |
| 134 | id AS ticket, |
| 135 | 'request_source' AS name, |
| 136 | 'None' AS value |
| 137 | FROM ticket |
| 138 | WHERE id NOT IN ( |
| 139 | SELECT ticket FROM ticket_custom WHERE name = 'request_source' |
| 140 | ); |
| 141 | }}} |
| 142 | |
109 | 143 | ---- |
110 | 144 | See also: TracTickets, TracIni |