Beego: syncdb with orm:m2m shows unsupported [err: unsupport field type [], may be miss setting tag]

Created on 14 Dec 2015  路  3Comments  路  Source: astaxie/beego

package models

type Persons struct {
Id int64 orm:"column(id);auto;pk"
FullName string orm:"column(full_name);size(512);index"
Addresses []*ContactAddresses orm:rel(m2m)
}

type ContactAddresses struct {
Id int64 orm:"column(id);auto"
Street1 string orm:"column(street1);size(256)"
Street2 string orm:"column(street2);size(256)"
area *Areas orm:"column(area_id);rel(fk)"
}
type Areas struct {
Id int64 orm:"column(id);auto;pk"
Zip string orm:"column(pincode);size(128);index"
City string orm:"column(taluka);size(128);index"
County string orm:"column(district);size(128);index"
State string orm:"column(state);size(128);index"
}
///// dbsync.go
package main
import (
"github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql"
)

func main() {
connStr := "root:@tcp(localhost:3306)/testdb?charset=utf8"
orm.RegisterDriver("mysql", orm.DR_MySQL)
orm.RegisterDataBase("default", "mysql", connStr)
orm.RegisterModel(new(models.Areas), new(models.ContactAddresses), new(models.Persons))
orm.RunCommand()
}

//execute
go build dbsync.go
./dbsync orm syncdb -v=true
field: models.Persons.Addresses, unsupport field type [], may be miss setting tag

$ bee version
bee :1.3.0
beego :1.5.0
Go :go version go1.5.2 darwin/amd64

P.S -> Although issue to regarding whey it is not supported, 'unsupport' is typo too (it could have been unsupported)

Most helpful comment

my bad. It was qotes missing
Addresses []_ContactAddresses orm:rel(m2m)
vs
Addresses []_ContactAddresses orm:"rel(m2m)"

All 3 comments

is there any work-around to this problem?

my bad. It was qotes missing
Addresses []_ContactAddresses orm:rel(m2m)
vs
Addresses []_ContactAddresses orm:"rel(m2m)"

Excuse me, Is Beego support model's field customizing锛烪ow....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DemonsLu picture DemonsLu  路  4Comments

im-here picture im-here  路  4Comments

natemara picture natemara  路  4Comments

apremalal picture apremalal  路  4Comments

kaushiksriram100 picture kaushiksriram100  路  3Comments