Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from SQLite to MySQL: Adding users failes #85

Closed
jthomaschewski opened this issue Oct 11, 2013 · 2 comments
Closed

Migration from SQLite to MySQL: Adding users failes #85

jthomaschewski opened this issue Oct 11, 2013 · 2 comments

Comments

@jthomaschewski
Copy link

I've used the migration instructions on https://github.com/haiwen/seafile/wiki/Migrate-data-from-SQLite-to-MySQL to migrate from SQLite to MySQL.

Now creation of users and even deleting them failes:

Error exec query INSERT INTO EmailUser(email, passwd, is_staff, is_active, ctime) VALUES ('test@example.com', 'XXXXXXXXXXX', '0', '1', 1381504900000000): Duplicate entry '0' for key 'PRIMARY'.

I'm getting a lot more similar errors (duplicate entry 0) in the logs

2013-10-11 18:34:46,206 [WARNING] seahub.utils:807 calc_dir_files_last_modified (1062, "Duplicate entry '0' for key 'PRIMARY'")

Seems as if "auto_increment" isn't enabled for IDs in mysql but altering columns to enable it fails to (same error).

I've checked table "EmailUser" and there is only one entry for "0"

@xiez
Copy link
Contributor

xiez commented Oct 12, 2013

Hi @JBBr , I've updated the scripts in the wiki, I'd appreciate if you can take a test, and please let me know if you have other problems.
Thanks!

@jthomaschewski
Copy link
Author

Hi @xiez , thanks for the update and generally for creating the migration guide and scripts!
I've recreated the .sql files with your script and tried importing them in a new clean test db. Importing succeeded without any errors.
In the "production" DB I already altered all tables with primary key ID column and enabled auto increment. Enabling does not work if there is any row with id=0 - so I just renamed it to something else, altered table and than renamed id back to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants