mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
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:
committed by
Facebook Github Bot
parent
aece79f8a8
commit
a4f82f2331
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user