GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
gorm.io/gorm v1.30.1 type Test struct { Id string gorm:"column:id;type:uuid;primary_key;not null" json:"id" Name string gorm:"column:name;type:text;not null" json:"name" }
func (Test) TableName() string { return "test" }
db.AutoMigrate(&Test{})
wsl=> \d test Table "wsl.test" Column | Type | Collation | Nullable | Default --------+------+-----------+----------+--------- id | uuid | | not null | name | text | | not null | Indexes: "test_pkey" PRIMARY KEY, btree (id)
type Test struct { Id string gorm:"column:id;type:uuid;primary_key;not null" json:"id" Name string gorm:"column:name;type:text;not null" json:"name" Label string gorm:"column:label;type:text" json:"label" // add a column }
db.Debug // Expected to automatically add table field 'label', but it did not take effect, // and there was a "pq: got 2 parameters but the statement requires 1" log printed during the execution process db.AutoMigrate(&Test{})
wsl=> \d test Table "wsl.test" Column | Type | Collation | Nullable | Default --------+------+-----------+----------+--------- id | uuid | | not null | name | text | | not null | Indexes: "test_pkey" PRIMARY KEY, btree (id)
Comment From: github-actions[bot]
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question
template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨