From a4f82f2331660fa351c6ecb802508dac3c3c34dc Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Wed, 13 Nov 2019 05:57:25 -0800 Subject: [PATCH] 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 --- entc/gen/storage.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/entc/gen/storage.go b/entc/gen/storage.go index 28b451596..101e00352 100644 --- a/entc/gen/storage.go +++ b/entc/gen/storage.go @@ -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