mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: move migrate annotation creation to init (#1165)
* fix issue with pointer values in Annotation * entc/gen: move migrate annotation creation to init Co-authored-by: Ruben de Vries <ruben@rubensayshi.com>
This commit is contained in:
@@ -24,7 +24,6 @@ var (
|
||||
Columns: UsersColumns,
|
||||
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{},
|
||||
Annotation: &entsql.Annotation{Table: "Users", Charset: "utf8mb4"},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
@@ -33,4 +32,10 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
UsersTable.Annotation = &entsql.Annotation{
|
||||
Table: "Users",
|
||||
Charset: "utf8mb4",
|
||||
}
|
||||
UsersTable.Annotation.Incremental = new(bool)
|
||||
*UsersTable.Annotation.Incremental = false
|
||||
}
|
||||
|
||||
@@ -57,9 +57,11 @@ func (User) Mixin() []ent.Mixin {
|
||||
|
||||
// Annotations of the User schema.
|
||||
func (User) Annotations() []schema.Annotation {
|
||||
incremental := false
|
||||
return []schema.Annotation{
|
||||
entsql.Annotation{
|
||||
Table: "Users",
|
||||
Table: "Users",
|
||||
Incremental: &incremental,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user