mirror of
https://github.com/ent/ent.git
synced 2026-05-04 00:20:58 +03:00
entc/gen: add support for indexing id fields (#991)
* fix: allow indexes to be created on ID field * test: add case for id field * remove extraneous nil check * change add primary method * add integration test for mixin id * go generate * add default for default * make linter happy * invert if statement * add default index to card integration test * add index on default id, mixin id, and composite index * go generate
This commit is contained in:
committed by
GitHub
parent
70fbcb24e5
commit
754e89c6ae
@@ -47,7 +47,7 @@ func NewTable(name string) *Table {
|
||||
|
||||
// AddPrimary adds a new primary key to the table.
|
||||
func (t *Table) AddPrimary(c *Column) *Table {
|
||||
t.Columns = append(t.Columns, c)
|
||||
t.AddColumn(c)
|
||||
t.PrimaryKey = append(t.PrimaryKey, c)
|
||||
return t
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user