Files
ent/entc/integration/migrate/entv2/schema/media.go

34 lines
701 B
Go

// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// Media holds the schema definition for the Media entity.
type Media struct {
ent.Schema
}
// Fields of the Media.
func (Media) Fields() []ent.Field {
return []ent.Field{
field.String("source").
Optional(),
field.String("source_uri").
Optional(),
}
}
// Indexes of the Media.
func (Media) Indexes() []ent.Index {
return []ent.Index{
index.Fields("source", "source_uri").Unique(),
}
}