mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/gen: allow setting unique fields with default values of type function (#610)
Fixed #609
This commit is contained in:
@@ -15,7 +15,7 @@ var (
|
||||
// BlobsColumns holds the columns for the "blobs" table.
|
||||
BlobsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeUUID},
|
||||
{Name: "uuid", Type: field.TypeUUID},
|
||||
{Name: "uuid", Type: field.TypeUUID, Unique: true},
|
||||
{Name: "blob_parent", Type: field.TypeUUID, Unique: true, Nullable: true},
|
||||
}
|
||||
// BlobsTable holds the schema information for the "blobs" table.
|
||||
|
||||
@@ -23,7 +23,8 @@ func (Blob) Fields() []ent.Field {
|
||||
field.UUID("id", uuid.UUID{}).
|
||||
Default(uuid.New),
|
||||
field.UUID("uuid", uuid.UUID{}).
|
||||
Default(uuid.New),
|
||||
Default(uuid.New).
|
||||
Unique(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user