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 // WithFixture sets the foreign-key renaming option to the migration when upgrading // ent from v0.1.0 (issue-#285). Defaults to false. WithFixture = schema.WithFixture // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys )
View Source
var ( // MemberColumns holds the columns for the "member" table. MemberColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "nickname", Type: field.TypeString, Unique: true, Size: 20}, {Name: "email", Type: field.TypeString, Nullable: true, Size: 50}, {Name: "phone", Type: field.TypeString, Nullable: true, Size: 11}, {Name: "password", Type: field.TypeString, Size: 100}, {Name: "status", Type: field.TypeEnum, Nullable: true, Enums: []string{"BLACKLIST"}}, {Name: "signature", Type: field.TypeString}, {Name: "last_pwd_auth", Type: field.TypeTime, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "delete_time", Type: field.TypeTime, Nullable: true}, } // MemberTable holds the schema information for the "member" table. MemberTable = &schema.Table{ Name: "member", Columns: MemberColumns, PrimaryKey: []*schema.Column{MemberColumns[0]}, } // MemberSecurityLogColumns holds the columns for the "member_security_log" table. MemberSecurityLogColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "uid", Type: field.TypeString, Size: 40}, {Name: "action", Type: field.TypeEnum, Enums: []string{"UNKNOWN", "SIGN_IN", "SIGN_OUT", "PWD_AUTH", "SIGN_IN___PWD", "SIGN_IN___PHONE", "SIGN_IN___EMAIL", "2ND_AUTH___PWD", "2ND_AUTH___PHONE", "2ND_AUTH___EMAIL"}, Default: "UNKNOWN"}, {Name: "ip", Type: field.TypeString, Nullable: true, Size: 128}, {Name: "request_id", Type: field.TypeString, Nullable: true, Size: 100}, {Name: "server_version", Type: field.TypeString, Nullable: true, Size: 50}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 200}, {Name: "remark", Type: field.TypeString, Nullable: true, Size: 200}, {Name: "create_time", Type: field.TypeTime}, } // MemberSecurityLogTable holds the schema information for the "member_security_log" table. MemberSecurityLogTable = &schema.Table{ Name: "member_security_log", Columns: MemberSecurityLogColumns, PrimaryKey: []*schema.Column{MemberSecurityLogColumns[0]}, } // SysSettingColumns holds the columns for the "sys_setting" table. SysSettingColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "key", Type: field.TypeString, Unique: true, Size: 100}, {Name: "value", Type: field.TypeString, Size: 2147483647}, {Name: "typeof", Type: field.TypeEnum, Enums: []string{"STRING", "NUMBER", "BOOLEAN", "ARRAY", "JSON"}, Default: "STRING"}, } // SysSettingTable holds the schema information for the "sys_setting" table. SysSettingTable = &schema.Table{ Name: "sys_setting", Columns: SysSettingColumns, PrimaryKey: []*schema.Column{SysSettingColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ MemberTable, MemberSecurityLogTable, SysSettingTable, } )
Functions ¶
This section is empty.
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.