Opened 2 years ago

Last modified 23 hours ago

#10054 new defect

Upgrade database error 0.5 to 1.0

Reported by: paul.jendrowski@… Owned by: martin_s
Priority: normal Component: WatchlistPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

Trying to upgrade from 0.5 to 1.0, get the following when running trac-admin upgrade:

OperationalError: table watchlist_new has 4 columns but 3 values were supplied

Running on trac 12.1, python 2.4.3 on RHEL5. To build egg file for 2.4, had to change: except Exception as e in several places. Using sqlite3 db.

Attachments (0)

Change History (2)

comment:1 Changed 10 months ago by rjollos

  • Description modified (diff)

#11332 may be a duplicate.

comment:2 Changed 23 hours ago by paul.jendrowski@…

Database version 4 now has columns: wluser, realm, resid, lastvisit. Database version 3 only has 3 columns so 'lastvisit' is new. In, upgrade_watchlist_table_from_v3_to_v4 needs to have

self.upgrade_watchlist_table_to_v4('wluser,realm,resid', db)

Then, upgrade_watchlist_table_to_v4 needs to have this where it copies the old table to the new

              INTO watchlist_new (%s)
            SELECT DISTINCT %s
              FROM watchlist
        """ % (selection,selection))

There will need to be an if check for whether selection contains "*", or a list of fields and construct the INSERT sql appropriately. Not sure what fields were in version 1 and 0 of the database so upgrade_watchlist_table_from_v0_to_v4 and upgrade_watchlist_table_from_v1_to_v4 might also need to supply fields in the call to upgrade_watchlist_table_to_v4.

Also, since column lastvisit is new, it needs to be determined whether this needs to be populated with a default value when the old table is copied. There probably is a way to set up the table schema to use a default value for the column if a null value for lastvisit will cause problems. Or a simple new sql command could be added to upgrade_watchlist_table_to_v4:

UPDATE watchlist SET lastvisit=0 WHERE lastvisit IS NULL

I hope this information helps.

Add Comment

Modify Ticket

as new .

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

Note: See TracTickets for help on using tickets.