Hi,
I have updated the version to 8.0.1 CE, from 7.1.4.
When trying to use the “Auto deletion” option. Throws an error - “Table ‘seafile-hub.repo_auto_delete’ doesn’t exist”.
There are no SQL queries to create the table “repo_auto_delete” in the database while updating.
But the Seafile code contains such a model - seahub/seahub/repo_auto_delete/migrations/0001_initial.py:
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RepoAutoDelete',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('repo_id', models.CharField(db_index=True, max_length=36, unique=True)),
('days', models.IntegerField(default=0)),
],
options={
'db_table': 'repo_auto_delete',
},
),
]
seahub.log
2021-01-03 23:00:19,024 [ERROR] django.request:222 log_response Internal Server Error: /api/v2.1/repos/3fd978de-968c-400c-a51f-0ced3403e19d/auto-delete/
Traceback (most recent call last):
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1146, "Table 'seafile-hub.repo_auto_delete' doesn't exist")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/opt/seafile/seafile-server-8.0.1/seahub/seahub/api2/endpoints/repo_auto_delete.py", line 44, in get
repo_auto_delete = RepoAutoDelete.objects.get(repo_id=repo_id)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/query.py", line 402, in get
num = len(clone)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/query.py", line 256, in __len__
self._fetch_all()
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/models/sql/compiler.py", line 1142, in execute_sql
cursor.execute(sql, params)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/opt/seafile/seafile-server-8.0.1/seahub/thirdpart/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 226, in query
_mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'seafile-hub.repo_auto_delete' doesn't exist")
UPDATE
If you create a table manually in the database, then everything works.
Like that
CREATE TABLE `repo_auto_delete` (
`id` INT NOT NULL AUTO_INCREMENT ,
`repo_id` VARCHAR(36) NOT NULL ,
`days` INT NOT NULL DEFAULT '0' ,
PRIMARY KEY (`id`),
UNIQUE `repo_id` (`repo_id`)
)
ENGINE = InnoDB;