Upgrade 5.1 to 6.02 mysql error

Hi, when I upgrade from 5.1 to 6.0.2 i got follow error


This script would upgrade your seafile server from 5.1 to 6.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/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 362, in
main()
File “/home/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 357, in main
db_updater.update_db()
File “/home/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 258, in update_db
super(SQLiteDBUpdater, self).update_db()
File “/home/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 120, in update_db
self.update_seahub_sql(seahub_sql)
File “/home/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 282, in update_seahub_sql
self.apply_sqls(self.seahub_db, sql_path)
File “/home/cloud/GobuCloud/seafile-server-6.0.2/upgrade/db_update_helper.py”, line 272, in apply_sqls
conn.execute(line)
sqlite3.OperationalError: table base_filecomment has no column named author

Failed to upgrade your database

Greetings Mario

From the log, it shows you are using SQLite as database, not mysql.

Yes i’m Using sql lite. Is upgrade_5.1_6.0.sh only for mysql?
How can i upgrade with sql lite?

hi, seems table base_filecomment already exists, can u paste your table schema ?

here are steps:

cd /home/cloud/GobuCloud/seafile-server-6.0.2/
sqlite3 seahub.db

then in prompt sqlite>

.schema base_filecomment

@SeaGOBU:~$ cd /home/cloud/GobuCloud/seafile-server-6.0.2/
@SeaGOBU:~/GobuCloud/seafile-server-6.0.2$ sqlite3 seahub.db
SQLite version 3.8.2 2013-12-06 14:53:30
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite> .schema base_filecomment;
sqlite> .schema base_filecomment
sqlite> .schema base_filecomment
sqlite>

then come nothing?

try sqlite> .tables

it will list all the tables, please double check whether there is base_filecomment table.

You can also check file seafile-server-6.0.2/upgrade/sql/6.0.0/sqlite3/seahub.sql which will be used by upgrade script.
There should be something like following:

CREATE TABLE IF NOT EXISTS "base_filecomment" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "parent_path" text NOT NULL, "repo_id_parent_path_md5" varchar(100) NOT NULL, "item_name" text NOT NULL, "author" varchar(255) NOT NULL, "comment" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
CREATE INDEX IF NOT EXISTS "base_filecomment_02bd92fa" ON "base_filecomment" ("author");
CREATE INDEX IF NOT EXISTS "base_filecomment_9a8c79bf" ON "base_filecomment" ("repo_id");
CREATE INDEX IF NOT EXISTS "base_filecomment_c5bf47d4" ON "base_filecomment" ("repo_id_parent_path_md5");

I tried 6.0.3 same error.

cloud@seafilecloud:~/seacloud/seafile-server-6.0.3$ sqlite3 seahub.db
SQLite version 3.8.2 2013-12-06 14:53:30
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite> .tables;
Error: unknown command or invalid arguments: “tables;”. Enter “.help” for help
sqlite>

CREATE TABLE IF NOT EXISTS “base_filecomment” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “repo_id” varchar(36) NOT NULL, “parent_path” text NOT NULL, "repo_id_pare$
CREATE INDEX IF NOT EXISTS “base_filecomment_02bd92fa” ON “base_filecomment” (“author”);
CREATE INDEX IF NOT EXISTS “base_filecomment_9a8c79bf” ON “base_filecomment” (“repo_id”);
CREATE INDEX IF NOT EXISTS “base_filecomment_c5bf47d4” ON “base_filecomment” (“repo_id_parent_path_md5”);

CREATE TABLE IF NOT EXISTS “termsandconditions_termsandconditions” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “slug” varchar(50) NOT NULL, “name” text NOT NULL, "v$
CREATE INDEX IF NOT EXISTS “termsandconditions_termsandconditions_2dbcba41” ON “termsandconditions_termsandconditions” (“slug”);

CREATE TABLE IF NOT EXISTS “termsandconditions_usertermsandconditions” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “username” varchar(255) NOT NULL, “ip_address” ch$
CREATE INDEX IF NOT EXISTS “termsandconditions_usertermsandconditions_2ab34720” ON “termsandconditions_usertermsandconditions” (“terms_id”);

CREATE TABLE IF NOT EXISTS “two_factor_phonedevice” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “user” varchar(255) NOT NULL UNIQUE, “name” varchar(64) NOT NULL, "c$
CREATE TABLE IF NOT EXISTS “two_factor_staticdevice” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “user” varchar(255) NOT NULL UNIQUE, “name” varchar(64) NOT NULL, "$
CREATE TABLE IF NOT EXISTS “two_factor_statictoken” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “token” varchar(16) NOT NULL, “device_id” integer NOT NULL REFERENCE$
CREATE TABLE IF NOT EXISTS “two_factor_totpdevice” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “user” varchar(255) NOT NULL UNIQUE, “name” varchar(64) NOT NULL, "co$
CREATE INDEX IF NOT EXISTS “two_factor_statictoken_94a08da1” ON “two_factor_statictoken” (“token”);
CREATE INDEX IF NOT EXISTS “two_factor_statictoken_9379346c” ON “two_factor_statictoken” (“device_id”);

CREATE TABLE IF NOT EXISTS “invitations_invitation” (“id” integer NOT NULL PRIMARY KEY AUTOINCREMENT, “token” varchar(40) NOT NULL, “inviter” varchar(255) NOT NULL, "acce$
CREATE INDEX IF NOT EXISTS “invitations_invitation_94a08da1” ON “invitations_invitation” (“token”);
CREATE INDEX IF NOT EXISTS “invitations_invitation_d5dd16f8” ON “invitations_invitation” (“inviter”);

ALTER TABLE api2_tokenv2 ADD COLUMN wiped_at datetime DEFAULT NULL;
ALTER TABLE api2_tokenv2 ADD COLUMN created_at datetime NOT NULL DEFAULT ‘1970-01-01 00:00:00’;

there is no ; after .tables , plz try again, thx

I had the almost the same problem but schema did give me some output.
Output of “.schema base_filecomment” :

seafile@box:~/$ sqlite3 seahub.db 
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema base_filecomment
CREATE TABLE "base_filecomment" (    "id" integer NOT NULL PRIMARY KEY,    "repo_id" varchar(36) NOT NULL,    "file_path" text NOT NULL,    "file_path_hash" varchar(12) NOT NULL,    "from_email" varchar(75) NOT NULL,    "message" text NOT NULL,    "timestamp" datetime NOT NULL);
CREATE INDEX "base_filecomment_ca6f7e34" ON "base_filecomment" ("repo_id");

Fixed the problem by removing the base_filecomment table (it did not contain any data) and rerunning the update script.

So long

EDIT:
A bit more on the procedure. But remember this is not an official fix just what worked for me. Use on our own responsibility.

# check if table is indeed wrong and contains no data
$ sqlite3 seahub.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema base_filecomment
CREATE TABLE "base_filecomment" (    "id" integer NOT NULL PRIMARY KEY,    "repo_id" varchar(36) NOT NULL,    "file_path" text NOT NULL,    "file_path_hash" varchar(12) NOT NULL,    "from_email" varchar(75) NOT NULL,    "message" text NOT NULL,    "timestamp" datetime NOT NULL);
CREATE INDEX "base_filecomment_ca6f7e34" ON "base_filecomment" ("repo_id");

# this should return nothing
sqlite> select * from base_filecomment;
sqlite>

# check if the schema is different from the update script
$ grep base_filecomment -r seafile-server-6.0.3/upgrade/
[..]
seafile-server-6.0.3/upgrade/sql/6.0.0/sqlite3/seahub.sql:CREATE TABLE IF NOT EXISTS "base_filecomment" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "repo_id" varchar(36) NOT NULL, "parent_path" text NOT NULL, "repo_id_parent_path_md5" varchar(100) NOT NULL, "item_name" text NOT NULL, "author" varchar(255) NOT NULL, "comment" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL);
[..]

# remove the table (be sure)
$ sqlite3 seahub.db
SQLite version 3.7.9 2011-11-01 00:52:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> DROP TABLE base_filecomment;
sqlite>
1 Like

Thank you, it works great.

Greetings Mario

having a similar issue, a functioning v5.1 trying to update to v6.0.5
Running the upgrade script ./upgrade_5.1_6.0.sh gives the following error:

Updating seafile/seahub database …

[ERROR] Error:
ccnet is using SQLite3
seafile is using SQLite3
seahub is using MySQL

Failed to upgrade your database

tried the solution above but no table exists

sqlite> DROP TABLE base_filecomment;
Error: no such table: base_filecomment

Any tips on how to debug?