#3408 closed defect (fixed)
[Patch] Mastertickets does not create table
Reported by: | Owned by: | Noah Kantrowitz | |
---|---|---|---|
Priority: | normal | Component: | MasterTicketsPlugin |
Severity: | major | Keywords: | mastertickets postgresql install |
Cc: | Trac Release: | 0.11 |
Description
How to Reproduce
I have just installed MasterTicketsPlugin through sudo easy_install --always-unzip 'http://trac-hacks.org/svn/masterticketsplugin/0.11'
. The Trac environment I run is a copy of another one, which had MasterTickets before and therefore a lot of the ticket entries in the database have non-null blocking and blockedby fields. Trac.ini does not have the custom fields defined (I erased then as I figured MasterTickets used its absence to detect a new install and then creat its own mastertickets table).
I have then enabled the plugin through WebAdmin. Then I got
Trac Error TracError: The Trac Environment needs to be upgraded. Run "trac-admin /boreste/trac/0000_00 upgrade"
To which I obliged with sudo trac-admin --no-backup /boreste/trac/0000_00 upgrade
(because backup is only run with SQLite) and got the traceback below.
System Information
Trac | 0.11
|
Python | 2.5.2 (r252:60911, Apr 21 2008, 11:38:26) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
|
setuptools | 0.6c8
|
psycopg2 | 2.0.6
|
Genshi | 0.5
|
Pygments | 0.9
|
Subversion | 1.4.6 (r28521)
|
jQuery: | 1.2.3
|
Python Traceback
Traceback (most recent call last): File "/usr/bin/trac-admin", line 8, in <module> load_entry_point('Trac==0.11', 'console_scripts', 'trac-admin')() File "/var/lib/python-support/python2.5/trac/admin/console.py", line 1249, in run return admin.onecmd(command) File "/var/lib/python-support/python2.5/trac/admin/console.py", line 104, in onecmd rv = cmd.Cmd.onecmd(self, line) or 0 File "/usr/lib/python2.5/cmd.py", line 219, in onecmd return func(arg) File "/var/lib/python-support/python2.5/trac/admin/console.py", line 1108, in do_upgrade self.__env.upgrade(backup=do_backup) File "/var/lib/python-support/python2.5/trac/env.py", line 442, in upgrade participant.upgrade_environment(db) File "/usr/lib/python2.5/site-packages/TracMasterTickets-2.1.2-py2.5.egg/mastertickets/api.py", line 63, in upgrade_environment raise e # If it is an OperationalError, just move on to the next table psycopg2.ProgrammingError: relation "mastertickets" does not exist
Attachments (1)
Change History (9)
comment:1 Changed 16 years ago by
comment:3 Changed 15 years ago by
Summary: | Mastertickets does not create table → [Patch] Mastertickets does not create table |
---|
comment:4 Changed 13 years ago by
Severity: | normal → major |
---|
I don't think this works. Using PG9.0, Python2.6, Trac 0.11.7, no table is created. In fact, to traffic to the database is even generated, as confirmed by tcpdump on the sending host. This is using the most recent git checkout for 0.11, both with and without the patch provided above:
## Trying to install MasterTickets Trac plugin (should create table in PG)
root@host:~# ls ~/coderanger-trac-mastertickets-20a99d3 build mastertickets setup.py temp TracMasterTickets.egg-info
root@host:/path/to/trac# easy_install ~/coderanger-trac-mastertickets-20a99d3/ Processing Running setup.py -q bdist_egg --dist-dir ~/coderanger-trac-mastertickets-20a99d3.bak/egg-dist-tmp-4gaei_ zip_safe flag not set; analyzing archive contents... Adding TracMasterTickets 2.2 to easy-install.pth file
Installed /usr/local/lib/python2.6/dist-packages/TracMasterTickets-2.2-py2.6.egg Processing dependencies for TracMasterTickets==2.2 Finished processing dependencies for TracMasterTickets==2.2
## No table create in PG - in fact, no traffic going out the interface at all
trac=> \dt
List of relations
Schema | Name | Type | Owner
public | attachment | table | tracadmin public | auth_cookie | table | tracadmin public | component | table | tracadmin public | enum | table | tracadmin public | milestone | table | tracadmin public | node_change | table | tracadmin public | permission | table | tracadmin public | report | table | tracadmin public | revision | table | tracadmin public | session | table | tracadmin public | session_attribute | table | tracadmin public | system | table | tracadmin public | ticket | table | tracadmin public | ticket_change | table | tracadmin public | ticket_custom | table | tracadmin public | version | table | tracadmin public | wiki | table | tracadmin
(17 rows)
root@host:~# tcpdump -v -i eth1 dst host tracdb.example.com tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes C 0 packets captured 8 packets received by filter 0 packets dropped by kernel
comment:5 Changed 13 years ago by
Sorry, that didn't get formatted very well; let me try again:
I don't think this works. Using PG9.0, Python2.6, Trac 0.11.7, no table is created. In fact, to traffic to the database is even generated, as confirmed by tcpdump on the sending host. This is using the most recent git checkout for 0.11, both with and without the patch provided above:
Trying to install MasterTickets Trac plugin (should create table in PG):
root@host:~# ls ~/coderanger-trac-mastertickets-20a99d3 build mastertickets setup.py temp TracMasterTickets.egg-info root@host:/path/to/trac# easy_install ~/coderanger-trac-mastertickets-20a99d3/ Processing Running setup.py -q bdist_egg --dist-dir ~/coderanger-trac-mastertickets-20a99d3.bak/egg-dist-tmp-4gaei_ zip_safe flag not set; analyzing archive contents... Adding TracMasterTickets 2.2 to easy-install.pth file Installed /usr/local/lib/python2.6/dist-packages/TracMasterTickets-2.2-py2.6.egg Processing dependencies for TracMasterTickets==2.2 Finished processing dependencies for TracMasterTickets==2.2
No table create in PG - in fact, no traffic going out the interface at all:
trac=> \dt List of relations Schema | Name | Type | Owner --------+-------------------+-------+----------- public | attachment | table | tracadmin public | auth_cookie | table | tracadmin public | component | table | tracadmin public | enum | table | tracadmin public | milestone | table | tracadmin public | node_change | table | tracadmin public | permission | table | tracadmin public | report | table | tracadmin public | revision | table | tracadmin public | session | table | tracadmin public | session_attribute | table | tracadmin public | system | table | tracadmin public | ticket | table | tracadmin public | ticket_change | table | tracadmin public | ticket_custom | table | tracadmin public | version | table | tracadmin public | wiki | table | tracadmin (17 rows) root@host:~# tcpdump -v -i eth1 dst host tracdb.example.com tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes ^C 0 packets captured 8 packets received by filter 0 packets dropped by kernel
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I'm not sure why you think installing the code should create a database (or how that would even work). Install and activate the plugin into an env, and then trac-admin upgrade it.
comment:7 Changed 13 years ago by
Not a database - a table. The inherent problem with upgrading was that "trac-admin /path/to/env upgrade" failed because the table was non-existent. I discovered the problem, but allow me to frame the answer with some context first.
During the migration of Trac to a new host where I would be upgrading the versions of Trac and Python (0.11rc2 -> 0.11.7, and 2.5 -> 2.6, respectively), as well as switching the database backend to Postgres, I observed that environment upgrades failed after installing and activating certain plugins because the tables they were dependent on did not exist (as noted above). I eventually realized that all plugins which need their own tables (MasterTickets, TracForms, et al) must be installed prior to the SQLite -> Postgres conversion (which I used sqlite2pg to perform).
comment:8 Changed 13 years ago by
By default sqlite2pg only translates the tables for Trac itself. Most of my plugins use a key in the system table (which is a core Trac thing) for schema versioning. If you delete the relevant keys in there it should recreate the tables.
And by the way, I'm using PostgreSQL 8.3. I will try to downgrade to 8.2 because the "strict type checking" issue, but I don't think it is related.