Error when upgrading to 8.0.1 : no such table: VirusFile


When trying to upgrade Seafile server from 7.1.5 to 8.0.1, with an sqlite backend, I get an error when running the upgrade script :

$ sudo ./

This script would upgrade your seafile server from 7.1 to 8.0
Press [ENTER] to contiune

Updating seafile/seahub database ...

[INFO] You are using SQLite3
[INFO] updating seahub database...
Traceback (most recent call last):
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 384, in <module>                                                             
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 379, in main                                                                 
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 275, in update_db                                                            
    super(SQLiteDBUpdater, self).update_db()
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 129, in update_db                                                            
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 299, in update_seahub_sql                                                    
    self.apply_sqls(self.seahub_db, sql_path)
  File "/home/julien/seafile/seafile-server-8.0.1/upgrade/", line 289, in apply_sqls                                                           
sqlite3.OperationalError: no such table: VirusFile

Failed to upgrade your database

Any idea on how to fix this ?

Thanks !

There are similar issues when upgrading the mysql backend - in this case the errors are syntax errors in the script which is meant to update the VirusFile table (and again this table doesn’t seem to exist - indeed searching the github repository for seafile-server the only place this table is mentioned seems to be the upgrade scripts for 8.0.1).

However, for mysql these are raised as warnings and the upgrade appears to otherwise complete without problems (although as mentioned in another thread, in my case LDAP authentication no longer works but I think that is not related).

I hit this issue today and it happens because the upgrade script expects the table called VirusFile to exist. I assume this is an oversight on the community version.

I fixed it by editing the upgrade SQL script. The problem happens on the line where it tries to rename the VirusFile table into VirusFile_old. That renamed table is later on nuked and VirusFile is created from scratch, so I see no issue by just removing three lines from the upgrade script; the one that renames the old non-existing table, copies stuff off it and the one that deletes the renamed table afterwards.

In short, edit this file: seafile-server-8.0.1/upgrade/sql/8.0.0/sqlite3/seahub.sql

Remove these 3 lines:

ALTER TABLE "VirusFile" RENAME TO "VirusFile_old";
INSERT INTO "VirusFile" ("vid", "repo_id", "commit_id", "file_path", "has_deleted") SELECT "vid", "repo_id", "commit_id", "file_path", "has_handle" FROM "VirusFile_old";
DROP TABLE "VirusFile_old"

and after that the upgrade should work. At least it did for me.

Naturally back up your stuff and proceed with your own risk, but at least to me the problem and the fix seemed pretty straight forward and resulted a working 7.1 -> 8.0 upgrade.

I have reported this issue here:

1 Like

I used your workaround and the upgrade went smoothly. Many thanks for taking the time to post it here and to report the issue in Github !