-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 19.11.2012 20:26, Christopher Nelson wrote:
>>> On Mon, Sep 17, 2012 at 11:12 AM, Ethan Jucovy <ethan.juc...@gmail.com>
>>> wrote:
>>> ...
>>> Or, if you *do* feel like just adding a dependency on TracSqlHelperScript,
>>> like I ended up doing, you could basically just copy all of the setup code
>>> in MultiRepoSearchPlugin here[1] and adjusting it for your needs.  In
>>> addition to demonstrating schema definition and table creation, it also uses
>>> Trac's system table to track what upgrades need to occur, and a neat little
>>> upgrade-steps-based-on-current-version framework thingie that I copied from
>>> TracHours.  (That's the `version()` and `steps =` stuff.)  I *think* this is
>>> considered The Right Way to manage upgrades in Trac plugins these days.
>>
>> Thanks.  I found an example in Subtickets plugin and will look at
>> TracHours, too.
> 
> Any advice on how to add fields to a private table in an upgrade script?

By fields you mean columns, right?

Because ALTER TABLE doesn't work for all supported backends equally
well, in general you'll want to
 * create a new temporary table as duplicating the existing one
 * delete existing table
 * re-create table with additional column
 * populate new table from copy of previous table
 * delete copy of previous table

That's the general pattern, that I've found in Trac core as well as in
some plugins. I've done it lately too [1], and with unit test coverage
for such upgrade modules I'm quite sure, that it works.

Steffen Hoffmann


[1]
http://trac-hacks.org/browser/announcerplugin/trunk/announcer/upgrades/db2.py?rev=12298
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlCqpakACgkQ31DJeiZFuHcWMgCgisPwQyLgcw7rXda0Fj/Rr6o/
wgwAoLG+OZr9gqC6P9BnISLucIO0d08m
=AZq7
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-dev@googlegroups.com.
To unsubscribe from this group, send email to 
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to