mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
ent/entc: corrently reference default value on migrate generation
Summary:
Migration incorrectly generated field default value on storage key inclusion.
Example Field:
```
field.String("tenant").
StorageKey("organization").
Default("fb-test"),
```
Generated default of:
```
// DefaultTenant holds the default value on creation for the tenant field.
DefaultTenant = descTenant.Default.(string)
```
But migration references non existent default (storage key is used):
```
{Name: "organization", Type: field.TypeString, Default: user.DefaultOrganization},
```
Reviewed By: a8m
Differential Revision: D17578898
fbshipit-source-id: afca92ac3f34c16100c868a10d0a480139bf4262
This commit is contained in:
committed by
Facebook Github Bot
parent
6cf5b918c3
commit
dacc568413
@@ -449,11 +449,6 @@ func (c *Column) ScanDefault(value string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasDefault reports if the column has a default value.
|
||||
func (c *Column) HasDefault() bool {
|
||||
return c.Default != nil
|
||||
}
|
||||
|
||||
// defaultValue adds tge `DEFAULT` attribute the the column.
|
||||
// Note that, in SQLite if a NOT NULL constraint is specified,
|
||||
// then the column must have a default value which not NULL.
|
||||
|
||||
Reference in New Issue
Block a user