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

Error 1170: BLOB/TEXT column 'key' used in key specification without a key length #42

Closed
hhstore opened this issue Sep 20, 2016 · 10 comments

Comments

@hhstore
Copy link

hhstore commented Sep 20, 2016

i try to run the demo, but when i run:

# this ok:
go get ./db/seeds/...

# happened an error:
go run db/seeds/main.go

the full log:

xx@mac [15时17分56秒] [~/xx/iGoSpace/src/github.com/qor/qor-example] [master]
-> % go run db/seeds/main.go

Failed to find configuration config/smtp.yml, using example file config/smtp.example.yml
Failed to find configuration config/database.yml, using example file config/database.example.yml
[info] replacing callback `gorm:delete` from /Users/xx/iGit/iGoSpace/src/github.com/qor/publish/publish.go:147
Failed to create unique index for translations key & locale, got: Error 1170: BLOB/TEXT column 'key' used in key specification without a key length

(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)

[2016-09-20 15:18:09]
[auth]     Loading
[confirm]  Loading
[recover]  Loading
[register] Loading
Start create sample data...
--> Created setting.
--> Created seo.
--> Created admin users.
--> Created users.
--> Created addresses.
--> Created categories.
--> Created collections.
--> Created colors.
--> Created sizes.
----> Downloaded http://qor3.s3.amazonaws.com/01-tee-c.20160316044516567824937.png
----> Downloaded http://qor3.s3.amazonaws.com/02-jacket-a.20160316042916412393755.png
----> Downloaded http://qor3.s3.amazonaws.com/03-hoodie-a.20160316050016575943551.png
----> Downloaded http://qor3.s3.amazonaws.com/04-watch-a.20160316055316228073566.png
----> Downloaded http://qor3.s3.amazonaws.com/05-watch-a.20160316050616453080832.png
----> Downloaded http://qor3.s3.amazonaws.com/06-watch-b.20160316051716100503633.png
----> Downloaded http://qor3.s3.amazonaws.com/07-necktie-b.20160316054316215346502.png
----> Downloaded http://qor3.s3.amazonaws.com/08-shoes-d.20160316053316367027290.png
----> Downloaded http://qor3.s3.amazonaws.com/9-book-c.20160316055616619095831.png
----> Downloaded http://qor3.s3.amazonaws.com/10-iphone-case-a.20160316050116186604394.png
----> Downloaded http://qor3.s3.amazonaws.com/11-mousepad-a.20160316061516297102890.png
--> Created products.
--> Created stores.
--> Created orders.
----> Downloaded http://qor3.s3.amazonaws.com/google_banner.jpg
----> Downloaded http://qor3.s3.amazonaws.com/qor_logo.png
----> Downloaded http://qor3.s3.amazonaws.com/slide1.jpg
----> Downloaded http://qor3.s3.amazonaws.com/slide2.jpg
----> Downloaded http://qor3.s3.amazonaws.com/slide3.jpg
--> Created widgets.
--> Done!

the error:

(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)

i am new to this project, should i care about this error, or just ignore it ?

@hhstore
Copy link
Author

hhstore commented Sep 20, 2016

then run main.go, error log:

xx@mac [15时34分34秒] [~/xx/iGoSpace/src/github.com/qor/qor-example] [master]
-> % go run main.go

Failed to find configuration config/smtp.yml, using example file config/smtp.example.yml
Failed to find configuration config/database.yml, using example file config/database.example.yml
[info] replacing callback `gorm:delete` from /Users/xx/iGit/iGoSpace/src/github.com/qor/publish/publish.go:147
Failed to create unique index for translations key & locale, got: Error 1170: BLOB/TEXT column 'key' used in key specification without a key length

(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)
[2016-09-20 15:34:37]
[register] Loading
[auth]     Loading
[confirm]  Loading
[recover]  Loading
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /                         --> github.com/qor/qor-example/app/controllers.HomeIndex (4 handlers)
[GIN-debug] GET    /products/:code           --> github.com/qor/qor-example/app/controllers.ProductShow (4 handlers)
[GIN-debug] GET    /switch_locale            --> github.com/qor/qor-example/app/controllers.SwitchLocale (4 handlers)
[register] Route: /auth/register
[auth]     Route: /auth/login
[auth]     Route: /auth/logout
[confirm]  Route: /auth/confirm
[recover]  Route: /auth/recover
[recover]  Route: /auth/recover/complete


Duplicated meta Name defined for resource Widget Content
goroutine 1 [running]:
runtime/debug.Stack(0x2d, 0xc4210dd7a8, 0x2)
    /usr/local/Cellar/go/1.7.1/libexec/src/runtime/debug/stack.go:24 +0x79
runtime/debug.PrintStack()
    /usr/local/Cellar/go/1.7.1/libexec/src/runtime/debug/stack.go:16 +0x22
github.com/qor/qor/utils.ExitWithMsg(0x679960, 0xc421012090, 0xc4210dd7a8, 0x2, 0x2)
    /Users/xx/iGit/iGoSpace/src/github.com/qor/qor/utils/utils.go:175 +0x161
github.com/qor/admin.(*Resource).Meta(0xc420065520, 0xc420ffb200, 0xc4210dd858)
    /Users/xx/iGit/iGoSpace/src/github.com/qor/admin/resource.go:46 +0x2f1
github.com/qor/widget.(*QorWidgetSetting).ConfigureQorResource(0xc4208e29c0, 0xa7ce80, 0xc420065520)
    /Users/xx/iGit/iGoSpace/src/github.com/qor/widget/setting.go:131 +0x13e
github.com/qor/admin.(*Resource).configure(0xc420065520)
    /Users/xx/iGit/iGoSpace/src/github.com/qor/admin/resource.go:498 +0x21b
github.com/qor/admin.(*Admin).MountTo(0xc4201d7b80, 0x75c056, 0x6, 0xc420b2f920)
    /Users/xx/iGit/iGoSpace/src/github.com/qor/admin/route.go:268 +0x262
main.main()
    /Users/xx/iGit/iGoSpace/src/github.com/qor/qor-example/main.go:18 +0xc3
Listening on: 7000

my develop environment:

- mac osx
- xampp (for mysql)
- go 1.7.1

issue:

  1. this could access by browser, http:127.0.0.1:7000
  2. but login module and register module are not work.
  3. any packages have i missed install?

@nateweisiger
Copy link

nateweisiger commented Oct 5, 2016

I get this same message as well. It is occurring because the column "key" in the translations table. See below:
http://stackoverflow.com/questions/1827063/mysql-error-key-specification-without-a-key-length

So far it hasn't caused me any problems.

@leenux
Copy link

leenux commented Oct 12, 2016

same +1
我在第一步go get ./db/seeds/...就提示错误:
# go get ./db/seeds/...
# github.com/qor/qor-example/db/seeds
runtime.main: call to external function main.main
runtime.main: main.main: not defined
runtime.main: undefined: main.main
第二步跟题主同样错误

go是1.7.1

@jinzhu
Copy link
Contributor

jinzhu commented Oct 12, 2016

Need to run go run db/seeds/main.go db/seeds/seeds.go to generate the sample data.

@jinzhu jinzhu closed this as completed Oct 12, 2016
@herohenu
Copy link

go run db/seeds/main.go db/seeds/seeds.go

it helped me

@randomtask2000
Copy link

randomtask2000 commented Dec 20, 2017

I have tried running go run db/seeds/main.go db/seeds/seeds.go and I still get this error mysql:

Failed to create unique index for translations key & locale, got: Error 1170: BLOB/TEXT column 'key' 
used in key specification without a key length

(Error 1170: BLOB/TEXT column 'key' used in key specification without a key length)

Does anyone know how to fix this? It appears to be a repository data type issue. I have also seen post on mysql projects stating that you can't generate a key on a limitless BLOB/TEXT field unless you change the datatype to a VARCHAR or limit the indexed field chars.

Bottom line, how do I fix this?

@nateweisiger
Copy link

To fix - Remove that field from the table create. If I remember correctly, that is only used for the translate feature.

@ghost
Copy link

ghost commented Jan 8, 2018

@nateweisiger this is not a fix, this is a workaround.

Can anyone help us?

@nateweisiger
Copy link

It is a fix if you are not using multiple languages.

@ghost
Copy link

ghost commented Jan 9, 2018

Okay so it's maybe a fix for your project but not for qor project which should support multiple languages.

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

6 participants