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 ( // TotoroOrgColumns holds the columns for the "totoro_org" table. TotoroOrgColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "delete_time", Type: field.TypeInt64, Default: 0}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Size: 255}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "logo", Type: field.TypeString, Size: 512}, {Name: "status", Type: field.TypeString, Size: 64}, {Name: "type", Type: field.TypeString, Size: 64}, } // TotoroOrgTable holds the schema information for the "totoro_org" table. TotoroOrgTable = &schema.Table{ Name: "totoro_org", Columns: TotoroOrgColumns, PrimaryKey: []*schema.Column{TotoroOrgColumns[0]}, } // TotoroRoleColumns holds the columns for the "totoro_role" table. TotoroRoleColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "delete_time", Type: field.TypeInt64, Default: 0}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "remark", Type: field.TypeString, Nullable: true}, {Name: "deleted_time", Type: field.TypeInt64}, } // TotoroRoleTable holds the schema information for the "totoro_role" table. TotoroRoleTable = &schema.Table{ Name: "totoro_role", Columns: TotoroRoleColumns, PrimaryKey: []*schema.Column{TotoroRoleColumns[0]}, } // TotoroRoleBindingColumns holds the columns for the "totoro_role_binding" table. TotoroRoleBindingColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "delete_time", Type: field.TypeInt64, Default: 0}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "role_name", Type: field.TypeString}, {Name: "user_id", Type: field.TypeString}, {Name: "deleted_time", Type: field.TypeInt64, Nullable: true}, } // TotoroRoleBindingTable holds the schema information for the "totoro_role_binding" table. TotoroRoleBindingTable = &schema.Table{ Name: "totoro_role_binding", Columns: TotoroRoleBindingColumns, PrimaryKey: []*schema.Column{TotoroRoleBindingColumns[0]}, } // TotoroUserColumns holds the columns for the "totoro_user" table. TotoroUserColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "delete_time", Type: field.TypeInt64, Default: 0}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "email", Type: field.TypeString, Nullable: true}, {Name: "phone", Type: field.TypeString, Nullable: true}, {Name: "gender", Type: field.TypeString, Nullable: true, Default: "0"}, {Name: "avatar", Type: field.TypeString, Nullable: true}, {Name: "password", Type: field.TypeString, Nullable: true}, {Name: "non_locked", Type: field.TypeInt, Nullable: true, Default: 1}, } // TotoroUserTable holds the schema information for the "totoro_user" table. TotoroUserTable = &schema.Table{ Name: "totoro_user", Columns: TotoroUserColumns, PrimaryKey: []*schema.Column{TotoroUserColumns[0]}, Indexes: []*schema.Index{ { Name: "user_email_delete_time", Unique: true, Columns: []*schema.Column{TotoroUserColumns[6], TotoroUserColumns[1]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ TotoroOrgTable, TotoroRoleTable, TotoroRoleBindingTable, TotoroUserTable, } )
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.