mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
entc/gen: set foreign-key columns non-nullable for required edges (#1703)
Note, this only applies to edges without circular references. Fixed #1688 and #1374
This commit is contained in:
@@ -17,7 +17,7 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "expired", Type: field.TypeTime},
|
||||
{Name: "number", Type: field.TypeString},
|
||||
{Name: "user_card", Type: field.TypeInt, Unique: true, Nullable: true},
|
||||
{Name: "user_card", Type: field.TypeInt, Unique: true},
|
||||
}
|
||||
// CardsTable holds the schema information for the "cards" table.
|
||||
CardsTable = &schema.Table{
|
||||
@@ -29,7 +29,7 @@ var (
|
||||
Symbol: "cards_users_card",
|
||||
Columns: []*schema.Column{CardsColumns[3]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.SetNull,
|
||||
OnDelete: schema.NoAction,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user