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 )
View Source
var ( // MiniProgramAccountColumns holds the columns for the "mini_program_account" table. MiniProgramAccountColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "user_identity", Type: field.TypeString, Nullable: true}, {Name: "open_id", Type: field.TypeString, Nullable: true}, {Name: "nick_name", Type: field.TypeString, Default: ""}, {Name: "avatar_url", Type: field.TypeString, Default: ""}, {Name: "gender", Type: field.TypeInt32}, {Name: "country", Type: field.TypeString, Default: ""}, {Name: "province", Type: field.TypeString, Default: ""}, {Name: "city", Type: field.TypeString, Default: ""}, {Name: "language", Type: field.TypeString, Default: ""}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // MiniProgramAccountTable holds the schema information for the "mini_program_account" table. MiniProgramAccountTable = &schema.Table{ Name: "mini_program_account", Columns: MiniProgramAccountColumns, PrimaryKey: []*schema.Column{MiniProgramAccountColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // PhoneAccountColumns holds the columns for the "phone_account" table. PhoneAccountColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "user_identity", Type: field.TypeString, Nullable: true}, {Name: "phone", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // PhoneAccountTable holds the schema information for the "phone_account" table. PhoneAccountTable = &schema.Table{ Name: "phone_account", Columns: PhoneAccountColumns, PrimaryKey: []*schema.Column{PhoneAccountColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // UserColumns holds the columns for the "user" table. UserColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "identity", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeInt32}, {Name: "is_disable", Type: field.TypeInt32}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // UserTable holds the schema information for the "user" table. UserTable = &schema.Table{ Name: "user", Columns: UserColumns, PrimaryKey: []*schema.Column{UserColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // UserAccountColumns holds the columns for the "user_account" table. UserAccountColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "user_identity", Type: field.TypeString, Nullable: true}, {Name: "account", Type: field.TypeInt64, Nullable: true}, {Name: "password", Type: field.TypeString, Default: ""}, {Name: "salt", Type: field.TypeString, Default: ""}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // UserAccountTable holds the schema information for the "user_account" table. UserAccountTable = &schema.Table{ Name: "user_account", Columns: UserAccountColumns, PrimaryKey: []*schema.Column{UserAccountColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // UserExtendColumns holds the columns for the "user_extend" table. UserExtendColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "user_identity", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // UserExtendTable holds the schema information for the "user_extend" table. UserExtendTable = &schema.Table{ Name: "user_extend", Columns: UserExtendColumns, PrimaryKey: []*schema.Column{UserExtendColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // UserInfoColumns holds the columns for the "user_info" table. UserInfoColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "user_identity", Type: field.TypeString, Nullable: true}, {Name: "channel", Type: field.TypeInt32}, {Name: "form", Type: field.TypeInt32}, {Name: "created_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "updated_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, } // UserInfoTable holds the schema information for the "user_info" table. UserInfoTable = &schema.Table{ Name: "user_info", Columns: UserInfoColumns, PrimaryKey: []*schema.Column{UserInfoColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ MiniProgramAccountTable, PhoneAccountTable, UserTable, UserAccountTable, UserExtendTable, UserInfoTable, } )
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.