ent/gen: add indexes to schema modes

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/158

Reviewed By: dlvhdr

Differential Revision: D18476130

fbshipit-source-id: a2003a9a51df6712f18ec58326569c2de7c42b83
This commit is contained in:
Ariel Mashraki
2019-11-13 05:57:25 -08:00
committed by Facebook Github Bot
parent aece79f8a8
commit a4f82f2331

View File

@@ -12,13 +12,16 @@ import (
"github.com/facebookincubator/ent/dialect/sql"
)
// A SchemaOption defines what type of schema feature a storage driver support.
// A SchemaMode defines what type of schema feature a storage driver support.
type SchemaMode uint
const (
// Unique defines field and edge uniqueness support.
Unique SchemaMode = 1 << iota
// Indexes defines indexes support.
Indexes
// Cascade defines cascading operations (e.g. cascade deletion).
Cascade
@@ -51,7 +54,7 @@ var drivers = []*Storage{
Imports: []string{
"github.com/facebookincubator/ent/dialect/sql",
},
SchemaMode: Unique | Cascade | Migrate,
SchemaMode: Unique | Indexes | Cascade | Migrate,
Ops: func(f *Field) []Op {
if !f.IsString() {
return nil