dialect/sql/schema: support DESC indexes using atlasgo.io

This commit is contained in:
Ariel Mashraki
2022-01-31 13:22:26 +02:00
committed by Ariel Mashraki
parent 94499bd141
commit 51663407cf
6 changed files with 37 additions and 3 deletions

View File

@@ -162,6 +162,14 @@ var (
Unique: true,
Columns: []*schema.Column{UsersColumns[7], UsersColumns[3]},
},
{
Name: "user_age",
Unique: false,
Columns: []*schema.Column{UsersColumns[3]},
Annotation: &entsql.IndexAnnotation{
Desc: true,
},
},
},
}
// FriendsColumns holds the columns for the "friends" table.

View File

@@ -124,6 +124,8 @@ func (User) Indexes() []ent.Index {
// and defining a new one.
index.Fields("phone", "age").
Unique(),
index.Fields("age").
Annotations(entsql.Desc()),
}
}