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

数据库编码不为默认的时候,会报错Specified key was too long; max key length is 767 bytes #24

Open
jemygraw opened this issue Jun 22, 2014 · 1 comment

Comments

@jemygraw
Copy link

如果像这样创建数据库

CREATE DATABASE `wetalk`  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin 

则运行

./wetalk orm syncdb

的时候,会报错,错误如标题所示。
经检查,utf8存储方式所占用的字节过多导致。
建议对表的列设置一个合适的长度。

目前发现
user_socialsetting两张表会出现这个问题。

@jemygraw
Copy link
Author

user_social对应的代码在social-auth目录下的models.go里面。

func (e *UserSocial) TableUnique() [][]string {
    return [][]string{
        {"Identify", "Type"},
    }
}

有必要将这个设为联合键么?

setting的代码位于wetalk/models/auth.go里面。

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

1 participant