Gorm: AutoMigrate not creating schema

Created on 28 Apr 2016  路  4Comments  路  Source: go-gorm/gorm

My struct is defined as follows:

type Article struct {
    gorm.Model
    title string `gorm:"not null; unique"`
    url string
    raw string `sql:"text"`
    relations []string `sql:"type:JSONB NOT NULL DEFAULT '{}'::JSONB"`
    filename string
}

when I place the call db.AutoMigrate(&Article{}), it successfully creates all the gorm.Model schema (id, created_at, etc), but does not create additional properties.

I thought it might be an error in my schema definition, but have tried with simpler schemas to no avail.

Most helpful comment

If I remember correctly it creates only names with uppercase first letter so that it gets exported

All 4 comments

Can u paste exectutable code..

Sorry trying to goto bug list as a kind ateam member in triage

Here you go.

https://gist.github.com/ianseyer/a6101c7f39d85a478eea0fe684428b10

Watch out - it's experimentally concurrent. Can't get it to work until I can create my Schema (and I don't want to do it manually).

If I remember correctly it creates only names with uppercase first letter so that it gets exported

That appears to be correct. Less-than-silent errors would be greatly appreciated.

However, now it appears that relations and filename are not being created.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kumarsiva07 picture kumarsiva07  路  3Comments

fieryorc picture fieryorc  路  3Comments

rfyiamcool picture rfyiamcool  路  3Comments

bramp picture bramp  路  3Comments

littletwolee picture littletwolee  路  3Comments