mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
fix: pk forces the Type of the numeric to be TypeInt so that the user defined id type is invalid (#926)
This commit is contained in:
@@ -919,7 +919,7 @@ func (f Field) size() int64 {
|
||||
func (f Field) PK() *schema.Column {
|
||||
c := &schema.Column{
|
||||
Name: f.StorageKey(),
|
||||
Type: field.TypeInt,
|
||||
Type: f.Type.Type,
|
||||
Key: schema.PrimaryKey,
|
||||
Increment: true,
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ import (
|
||||
var (
|
||||
// UsersColumns holds the columns for the "users" table.
|
||||
UsersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "id", Type: field.TypeUint64, Increment: true},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "user_spouse", Type: field.TypeInt, Unique: true, Nullable: true},
|
||||
{Name: "user_spouse", Type: field.TypeUint64, Unique: true, Nullable: true},
|
||||
}
|
||||
// UsersTable holds the schema information for the "users" table.
|
||||
UsersTable = &schema.Table{
|
||||
|
||||
Reference in New Issue
Block a user