Noah Kantrowitz | 9 Feb 20:48
Gravatar

RE: [Trac] regarding new database tables and safety

You create the new tables once in a DB upgrade (which requires admin access, but so does installing the plugin anyway), you can then write to them as much as you want. Not sure what the question is, this is standard SQL practice.

 

--Noah

 

From: Vishal [mailto:vsapre80-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org]
Sent: Tuesday, February 09, 2010 2:15 AM
To: trac-users-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: Noah Kantrowitz
Subject: Re: [Trac] regarding new database tables and safety

 

 

On Tue, Feb 9, 2010 at 1:37 PM, Noah Kantrowitz <noah-WlrdLoc5ZbaFX2APIN6yfw@public.gmane.org> wrote:


On Feb 8, 2010, at 9:43 PM, Vishal wrote:

Hi,

I would like to add some extra data to the trac installation I have,
and for this I may need to add extra tables to the database being
used. Since the database schema will change from the default one, i
would like to know under what situations will a trac database update
be required (as done by using the upgrade command from trad-admin)?
Also, if there is no way to avoid the upgrade, is there a way to do
this seamlessly, so a user does not know about it.

 

My snippet for doing this is http://trac-hacks.org/browser/tracforgeplugin/0.11/tracforge/admin/api.py#L69

http://trac-hacks.org/browser/tracforgeplugin/0.11/tracforge/admin/db_default.py shows how I setup my schema.

As for making it transparent, no, Trac doesn't work that way. This is primarily for safety reasons. DDL changes (like changing tables) generally can't be rolled back as part of a transaction if the upgrade fails, so you could end up with a bad DB. This is why trac-admin upgrade makes a backup for you if possible (or requires you to state that you are okay without one since you took a DB backup yourself).

 

An example for this situation is the client plugin. Whenever I try to
add a new client or change anything in the client custom filed, the
trac project asks me to do an upgrade. This would be sort of very
difficult for the end user, particularly since they wont have admin
permissions, but would need to to add a client nonetheless.

 

I don't know what the client plugin is doing, but changing custom fields doesn't require a DB change, it doesn't even require a server restart.


--Noah

 

Yes I agree that custom tickets and their options etc, donot even require a server restart.

 

Actually here is the issue, I would like add some custom ticket entries of 'select' type. The options in this case could well be in hundreds. I was thinking, if it would be possible to store these in the db, instead of the INI.

 

I am in the process of creating a customer database to be used with the issue tracking done in TRAC, and we would like to create a release management system as well.

Do bring realease management, customer management and issue management into a customized whole, it seems proper that we might have to add new tables to the db.

 

If the upgrade is unavoidable, it would mean, we'll have to make sure the admin adds new stuff to these tables.

 

Guess I am unclear about how one can write to new tables and avoid upgrades.

 

s

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to trac-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

Gmane