migrating from [Trac 1.0] to [Trac 1.4] TracError: OperationalError: no such column: description

migrating from [Trac 1.0] to [Trac 1.4] TracError: OperationalError: no such column: description

如磁贴中所述,我正在尝试从 Trac 1.0.11 迁移到 1.4.2(使用 SQLite 后端),但在执行“trac-admin [path] upgrade”命令时出现错误。

TracError: OperationalError: no such column: description

我不知道这个描述栏可以在哪里以及它可以与什么相关。请问有人知道发生了什么事吗? 注意:我实际上迁移了 2 个工作区,但只有一个失败了;唯一的功能区别是失败的一个使用了 MultipleWorkflowPlugin,而另一个没有。

以下是该问题的日志跟踪:

2021-01-18 16:21:53,200 Trac[env] ERROR: Exception caught while checking for upgrade: 
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/trac/env.py", line 868, in open_environment
    needs_upgrade = env.needs_upgrade()
  File "/usr/lib/python2.7/site-packages/trac/env.py", line 747, in needs_upgrade
    for participant in self.setup_participants:
  File "/usr/lib/python2.7/site-packages/trac/core.py", line 95, in extensions
    components = [component.compmgr[cls] for cls in classes]
  File "/usr/lib/python2.7/site-packages/trac/core.py", line 238, in __getitem__
    component = cls(self)
  File "/usr/lib/python2.7/site-packages/trac/core.py", line 157, in __call__
    self.__init__()
  File "build/bdist.linux-x86_64/egg/multipleworkflow/workflow.py", line 113, in __init__
    for t in self._ticket_types + ['default']:
  File "build/bdist.linux-x86_64/egg/multipleworkflow/workflow.py", line 122, in _ticket_types
    return [enum.name for enum in model.Type.select(self.env)]
  File "/usr/lib/python2.7/site-packages/trac/ticket/model.py", line 878, in select
    (cls.type,)):
  File "/usr/lib/python2.7/site-packages/trac/db/util.py", line 129, in execute
    cursor.execute(query, params if params is not None else [])
  File "/usr/lib/python2.7/site-packages/trac/db/util.py", line 62, in execute
    r = self.cursor.execute(sql_escape_percent(sql), args)
  File "/usr/lib/python2.7/site-packages/trac/db/sqlite_backend.py", line 87, in execute
    result = PyFormatCursor.execute(self, *args)
  File "/usr/lib/python2.7/site-packages/trac/db/sqlite_backend.py", line 63, in execute
    args or [])
  File "/usr/lib/python2.7/site-packages/trac/db/sqlite_backend.py", line 54, in _rollback_on_error
    return function(self, *args, **kwargs)
OperationalError: no such column: description

PS:之前迁移到 1.0.13 版本的数据库存在同样的问题。

感谢您的帮助。

这是我以前从未见过的一些行为,但我认为这是有道理的。

解决方法

  1. 禁用 MultipleWorkflowPlugin
  2. 运行 upgrade
  3. 启用 MultipleWorkflowPlugin。

在执行 upgrade 时打开环境时加载组件。初始化 MultipleWorkflowPlugin 组件时,它会尝试获取所有枚举,这会执行查询 description 列的 SQL。 description 列在 upgrade 完成之前不存在,因此会产生错误。

编辑:此问题应在最新版本的 MultipleWorkflowPlugin 中得到修复,请参阅 #13943

插件的源代码已于上周修复。谢谢 https://trac-hacks.org/ticket/13943