Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // WithGlobalUniqueID sets the universal ids options to the migration. // If this option is enabled, ent migration will allocate a 1<<32 range // for the ids of each entity (table). // Note that this option cannot be applied on tables that already exist. WithGlobalUniqueID = schema.WithGlobalUniqueID // WithDropColumn sets the drop column option to the migration. // If this option is enabled, ent migration will drop old columns // that were used for both fields and edges. This defaults to false. WithDropColumn = schema.WithDropColumn // WithDropIndex sets the drop index option to the migration. // If this option is enabled, ent migration will drop old indexes // that were defined in the schema. This defaults to false. // Note that unique constraints are defined using `UNIQUE INDEX`, // and therefore, it's recommended to enable this option to get more // flexibility in the schema changes. WithDropIndex = schema.WithDropIndex // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys )
View Source
var ( // LanguageSettingsColumns holds the columns for the "language_settings" table. LanguageSettingsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "translatable_types", Type: field.TypeJSON, Nullable: true}, {Name: "untranslated", Type: field.TypeString, Size: 16, Default: "original"}, } // LanguageSettingsTable holds the schema information for the "language_settings" table. LanguageSettingsTable = &schema.Table{ Name: "language_settings", Columns: LanguageSettingsColumns, PrimaryKey: []*schema.Column{LanguageSettingsColumns[0]}, } // LanguageVisibilityColumns holds the columns for the "language_visibility" table. LanguageVisibilityColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "kind", Type: field.TypeString, Size: 64}, {Name: "ref", Type: field.TypeString, Size: 64}, {Name: "langs", Type: field.TypeJSON}, } // LanguageVisibilityTable holds the schema information for the "language_visibility" table. LanguageVisibilityTable = &schema.Table{ Name: "language_visibility", Columns: LanguageVisibilityColumns, PrimaryKey: []*schema.Column{LanguageVisibilityColumns[0]}, Indexes: []*schema.Index{ { Name: "language_visibility_kind_ref", Unique: true, Columns: []*schema.Column{LanguageVisibilityColumns[1], LanguageVisibilityColumns[2]}, }, }, } // NodesColumns holds the columns for the "nodes" table. NodesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // NodesTable holds the schema information for the "nodes" table. NodesTable = &schema.Table{ Name: "nodes", Columns: NodesColumns, PrimaryKey: []*schema.Column{NodesColumns[0]}, } // NodeTranslationsColumns holds the columns for the "node_translations" table. NodeTranslationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "tnid", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "outdated", Type: field.TypeBool, Default: false}, {Name: "nid", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // NodeTranslationsTable holds the schema information for the "node_translations" table. NodeTranslationsTable = &schema.Table{ Name: "node_translations", Columns: NodeTranslationsColumns, PrimaryKey: []*schema.Column{NodeTranslationsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "node_translations_nodes_node", Columns: []*schema.Column{NodeTranslationsColumns[3]}, RefColumns: []*schema.Column{NodesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "node_translations_nid", Unique: true, Columns: []*schema.Column{NodeTranslationsColumns[3]}, }, { Name: "node_translations_tnid", Unique: false, Columns: []*schema.Column{NodeTranslationsColumns[1]}, }, }, } // TextTranslationsColumns holds the columns for the "text_translations" table. TextTranslationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "kind", Type: field.TypeString, Size: 64}, {Name: "ref", Type: field.TypeString, Size: 64}, {Name: "lang", Type: field.TypeString, Size: 12}, {Name: "value", Type: field.TypeString, Size: 2147483647, SchemaType: map[string]string{"mysql": "text"}}, } // TextTranslationsTable holds the schema information for the "text_translations" table. TextTranslationsTable = &schema.Table{ Name: "text_translations", Columns: TextTranslationsColumns, PrimaryKey: []*schema.Column{TextTranslationsColumns[0]}, Indexes: []*schema.Index{ { Name: "text_translations_kind_ref_lang", Unique: true, Columns: []*schema.Column{TextTranslationsColumns[1], TextTranslationsColumns[2], TextTranslationsColumns[3]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ LanguageSettingsTable, LanguageVisibilityTable, NodesTable, NodeTranslationsTable, TextTranslationsTable, } )
Functions ¶
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is the API for creating, migrating and dropping a schema.
Click to show internal directories.
Click to hide internal directories.