Modify

Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#7276 closed defect (fixed)

Can't install (environment upgrade fail)

Reported by: coxx@… Owned by: Martin Scharrer
Priority: normal Component: WatchlistPlugin
Severity: normal Keywords: environment upgrade unique
Cc: Trac Release: 0.12

Description

I can't install plugin. trac-admin <env> upgrade failed with traceback like this:

01:25:32 Trac[plugin] INFO: Watchlist table needs to be upgraded: no such table: watchlist
01:25:32 Trac[env] INFO: tracwatchlist.plugin.WatchlistPlugin upgrading...
01:25:32 Trac[plugin] INFO: Creating system table entry for watchlist plugin: No version entry in system table
01:25:32 Trac[plugin] INFO: No previous watchlist table found
01:25:32 Trac[plugin] INFO: Creating table '('watchlist',)' for WatchlistPlugin
01:25:32 Trac[plugin] INFO: Creating 'watchlist_settings' table
TypeError: __init__() got an unexpected keyword argument 'unique'
01:25:33 Trac[console] ERROR: Exception in trac-admin command:
Traceback (most recent call last):
  File "/opt/trac/lib/python2.6/site-packages/trac/admin/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "/opt/trac/lib/python2.6/site-packages/trac/admin/console.py", line 257, in default
    return cmd_mgr.execute_command(*args)
  File "/opt/trac/lib/python2.6/site-packages/trac/admin/api.py", line 123, in execute_command
    return f(*fargs)
  File "/opt/trac/lib/python2.6/site-packages/trac/env.py", line 790, in _do_upgrade
    self.env.upgrade(backup=no_backup is None)
  File "/opt/trac/lib/python2.6/site-packages/trac/env.py", line 533, in upgrade
    with_transaction(self)(participant.upgrade_environment)
  File "/opt/trac/lib/python2.6/site-packages/trac/db/api.py", line 77, in transaction_wrapper
    fn(ldb)
  File "/opt/trac/lib/python2.6/site-packages/tracwatchlist/plugin.py", line 637, in upgrade_environment
    self._create_db_table(db)
  File "/opt/trac/lib/python2.6/site-packages/tracwatchlist/plugin.py", line 563, in _create_db_table
    self._create_db_table2(db)
  File "/opt/trac/lib/python2.6/site-packages/tracwatchlist/plugin.py", line 577, in _create_db_table2
    Column('wluser', unique=True),
TypeError: __init__() got an unexpected keyword argument 'unique'

Attachments (0)

Change History (6)

comment:1 Changed 7 years ago by Martin Scharrer

Status: newassigned

Seems to be a DB backend issue.

What DB backend are you using? (Sqlite, Postgres, MySQL, ...) What exact version of Trac are you using (incl. revision etc.)?

comment:2 Changed 7 years ago by anonymous

I'm using Trac 0.12 from pypi.

Just look at this: http://trac.edgewall.org/changeset/9406/trunk/trac/db/schema.py

Here is my solution:

  • plugin.py

    old new  
    573573        db_connector, _ = DatabaseManager(self.env)._get_connector()
    574574        self.env.log.info("Creating 'watchlist_settings' table")
    575575
    576         table = Table('watchlist_settings')[
    577                     Column('wluser', unique=True),
     576        table = Table('watchlist_settings', key='wluser')[
     577                    Column('wluser'),
    578578                    Column('settings'),
    579579                ]

comment:3 Changed 7 years ago by Martin Scharrer

Resolution: fixed
Status: assignedclosed

(In [8139]) Fixed DB table creation issue. This fixes #7276.

comment:4 Changed 7 years ago by Martin Scharrer

Thanks for the patch. I applied this changes. Feel free to reopen this ticket if the error continues.

comment:5 Changed 5 years ago by Ryan J Ollos

Your explanation and patch helped in fixing this same issue in the TracHoursPlugin ([8060]/#10308) and BacklogPlugin ([11996]). Thanks!

comment:6 Changed 5 years ago by Ryan J Ollos

Keywords: environment upgrade unique added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Martin Scharrer.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.