I just converted my Seafile from using sqlite to mysql using the scripts and steps I found here:
https://manual.seafile.com/deploy/migrate_from_sqlite_to_mysql.html
Everything seemed to be working at first, but then I couldn’t connect from the phone app, and the “Devices” section under system admin wouldn’t load. I finally tracked it down to the “api2_tokenv2” table being missing from the “seahub-db” database.
To make a long story short, seahub-db.sql says to create the table with this line:
CREATE TABLE IF NOT EXISTS `api2_tokenv2` ( `key` varchar(40) NOT NULL PRIMARY KEY, `user` varchar(255) NOT NULL, \ `platform` varchar(32) NOT NULL, `device_id` varchar(40) NOT NULL, `device_name` varchar(40) NOT NULL, `platform\ _version` varchar(16) NOT NULL, `client_version` varchar(16) NOT NULL, `last_accessed` datetime NOT NULL, `last_l\ ogin_ip` char(39), wiped_at datetime DEFAULT NULL, created_at datetime NOT NULL DEFAULT `1970-01-01 00:00:00`, UNIQUE (\ `user`, `platform`, `device_id`)) ENGINE=INNODB;
But according to this stackoverflow answer, the datetime can’t have a default value in mysql before 5.6.5 (I am using 5.5.52 from debian packages) (sorry, apparently can’t link because my account is new)
h t t p s://stackoverflow.com/questions/168736/how-do-you-set-a-default-value-for-a-mysql-datetime-column
I just did this to find all the values that should be in api2_tokenv2,
grep -i “api2_tokenv2” seahub-db.sql
I made the table without the default (I hope that doesn’t cause problems), and did all the inserts to load the values in. Seems to be fine. Maybe a note in the “Migrate From SQLite to MySQL” page would help people avoid this in the future.
Also, is it ok that I don’t have that default anymore? Everything seems to be working so far.