升级7.0后md文件打不开

日志:
2019-05-30 10:08:55,534 [WARNING] django.request:152 get_response Not Found: /api2/events/
2019-05-30 10:12:10,664 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/repos/ae338a1c-cb98-4962-b83f-2202d89622d2/file/detail/
Traceback (most recent call last):
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/core/handlers/exception.py”, line 41, in inner
response = get_response(request)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/core/handlers/base.py”, line 249, in _legacy_get_response
response = self._get_response(request)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/core/handlers/base.py”, line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/core/handlers/base.py”, line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/views/decorators/csrf.py”, line 58, in wrapped_view
return view_func(*args, **kwargs)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/views/generic/base.py”, line 68, in view
return self.dispatch(request, *args, **kwargs)
File “/root/wewell/seafile-server-7.0.0/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/rest_framework/views.py”, line 466, in dispatch
response = self.handle_exception(exc)
File “/root/wewell/seafile-server-7.0.0/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/rest_framework/views.py”, line 463, in dispatch
response = handler(request, *args, **kwargs)
File “/root/wewell/seafile-server-7.0.0/seahub/seahub/api2/views.py”, line 3167, in get
comment_total = file_comments.count()
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/db/models/query.py”, line 364, in count
return self.query.get_count(using=self.db)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/db/models/sql/query.py”, line 499, in get_count
number = obj.get_aggregation(using, [‘__count’])[‘__count’]
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/db/models/sql/query.py”, line 480, in get_aggregation
result = compiler.execute_sql(SINGLE)
File “/root/wewell/seafile-server-7.0.0/seahub/thirdpart/django/db/models/sql/compiler.py”, line 899, in execute_sql
raise original_exception
OperationalError: no such column: base_filecomment.uuid_id

图片如下,一直是个圈圈在转。
md

6.3是好的,升级之后就打不开了,只有一个圆圈不断向外扩散着。

这是因为你在 6.3 版升级的时候忘记需要升级迁移文件评论数据库表了。修复方法如下:

进入 seahub_db, 删除 base_filecomment 数据库表,然后重新创建一下:

CREATE TABLE `base_filecomment` (

    `id` int(11) NOT NULL AUTO_INCREMENT,
  `author` varchar(255) NOT NULL,

    `comment` longtext NOT NULL,
  `created_at` datetime NOT NULL,

    `updated_at` datetime NOT NULL,
  `uuid_id` char(32) NOT NULL,

    `detail` longtext NOT NULL,
  `resolved` tinyint(1) NOT NULL,

    PRIMARY KEY (`id`),
  KEY `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` (`uuid_id`),

    KEY `base_filecomment_author_8a4d7e91` (`author`),

    KEY `base_filecomment_resolved_e0717eca` (`resolved`),

    CONSTRAINT `base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid` FOREIGN KEY (`uuid_id`) REFERENCES `tags_fileuuidmap` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

sqlite> DROP TABLE base_filecomment;
sqlite> .table

sqlite> CREATE TABLE base_filecomment (
…>
…> id int(11) NOT NULL AUTO_INCREMENT,
…> author varchar(255) NOT NULL,
…>
…> comment longtext NOT NULL,
…> created_at datetime NOT NULL,
…>
…> updated_at datetime NOT NULL,
…> uuid_id char(32) NOT NULL,
…>
…> detail longtext NOT NULL,
…> resolved tinyint(1) NOT NULL,
…>
…> PRIMARY KEY (id),
…> KEY base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid (uuid_id),
…>
…> KEY base_filecomment_author_8a4d7e91 (author),
…>
…> KEY base_filecomment_resolved_e0717eca (resolved),
…>
…> CONSTRAINT base_filecomment_uuid_id_4f9a2ca2_fk_tags_fileuuidmap_uuid FOREIGN KEY (uuid_id) REFERENCES tags_fileuuidmap (uuid)
…> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Error: near “AUTO_INCREMENT”: syntax error

删除后,重新加表报错。

SQLite3 应该使用以下的语句:

CREATE TABLE "base_filecomment" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
 "author" varchar(255) NOT NULL,
 "comment" text NOT NULL, 
"created_at" datetime NOT NULL, 
"updated_at" datetime NOT NULL, 
"uuid_id" char(32) NOT NULL REFERENCES "tags_fileuuidmap" ("uuid"), 
"detail" text NOT NULL, 
"resolved" bool NOT NULL);

Deal Ths !