B
B
bigazzzz2012-02-13 10:16:24
MySQL
bigazzzz, 2012-02-13 10:16:24

Multiproject Trac on MySQL. Create a new database each time?

There is a configured and working Trac, designed for multiprojects. MySQL is used as a database. On the server (ubuntu-server) it is planned to run from 5 to 10 simultaneously running projects + quite a lot of projects in the archive, i.e. not in active development.

Actually, the problem is that each time you initialize a new environment
sudo trac-admin /var/trac/new_proj initenvin the wizard, you need to specify the database via URI. mysql://trac_user:[email protected]:3306/trac_db
When you initialize a new environment with the same database, we will get an error
...OperationalError: (1050, "Table 'system' already exists")
. you need to create a new, clean database every time.

Question: How can I make use of prefixes in trac? So that you can use one database with different table prefixes. For example, project1_system, project2_system ... projectN_system
Or maybe there are other solutions?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DmZ, 2012-02-13
@bigazzzz

Simple variant:
At the moment it is not possible, because the table names are written explicitly in some places (for example, SQL queries in upgrade scripts ).
Medium difficulty:
Wait until there is support in the mainstream. Ticket #130 Multi-project support is already eight years old, and things are still there. True, the discussion moved forward and began to implement the concept of supporting several projects with one env (a little not what you need).
If you look in the ticket, there are references to crutches on PostgreSQL . You can try to implement the same approach with views in MySQL, but this will not add ease of adding an env ... It will just get rid of a bunch of databases at the expense of speed and convenience.
Difficult option:
Implement such support yourself and submit the patch to the mainstream.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question