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 ( // RdMessageColumns holds the columns for the "rd_message" table. RdMessageColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt32, Increment: true}, {Name: "sender_uid", Type: field.TypeInt32, Nullable: true}, {Name: "recver_uid", Type: field.TypeInt32, Nullable: true}, {Name: "content", Type: field.TypeJSON}, {Name: "create_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdMessageTable holds the schema information for the "rd_message" table. RdMessageTable = &schema.Table{ Name: "rd_message", Columns: RdMessageColumns, PrimaryKey: []*schema.Column{RdMessageColumns[0]}, } // RdMomentColumns holds the columns for the "rd_moment" table. RdMomentColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt64, Increment: true}, {Name: "type", Type: field.TypeInt32, Nullable: true, Default: 1}, {Name: "by_uid", Type: field.TypeInt32, Nullable: true}, {Name: "txt", Type: field.TypeString, Size: 2147483647}, {Name: "imgs", Type: field.TypeJSON}, {Name: "status", Type: field.TypeInt32, Nullable: true}, {Name: "publish_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdMomentTable holds the schema information for the "rd_moment" table. RdMomentTable = &schema.Table{ Name: "rd_moment", Columns: RdMomentColumns, PrimaryKey: []*schema.Column{RdMomentColumns[0]}, } // RdRMomentsFollowingColumns holds the columns for the "rd_r_moments_following" table. RdRMomentsFollowingColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt64, Increment: true}, {Name: "moment_id", Type: field.TypeInt64, Nullable: true, Default: 1}, {Name: "moment_type", Type: field.TypeInt32, Nullable: true, Default: 1}, {Name: "by_uid", Type: field.TypeInt32, Nullable: true}, {Name: "for_uid", Type: field.TypeInt32, Nullable: true}, {Name: "txt", Type: field.TypeString, Size: 2147483647}, {Name: "imgs", Type: field.TypeJSON}, {Name: "status", Type: field.TypeInt32, Nullable: true}, {Name: "publish_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdRMomentsFollowingTable holds the schema information for the "rd_r_moments_following" table. RdRMomentsFollowingTable = &schema.Table{ Name: "rd_r_moments_following", Columns: RdRMomentsFollowingColumns, PrimaryKey: []*schema.Column{RdRMomentsFollowingColumns[0]}, } // RdRUserFollowersColumns holds the columns for the "rd_r_user_followers" table. RdRUserFollowersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt64, Increment: true}, {Name: "uid", Type: field.TypeInt32, Nullable: true}, {Name: "followers_uid", Type: field.TypeInt32, Nullable: true}, {Name: "create_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdRUserFollowersTable holds the schema information for the "rd_r_user_followers" table. RdRUserFollowersTable = &schema.Table{ Name: "rd_r_user_followers", Columns: RdRUserFollowersColumns, PrimaryKey: []*schema.Column{RdRUserFollowersColumns[0]}, } // RdRUserFollowingColumns holds the columns for the "rd_r_user_following" table. RdRUserFollowingColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt64, Increment: true}, {Name: "uid", Type: field.TypeInt32, Nullable: true}, {Name: "following_uid", Type: field.TypeInt32, Nullable: true}, {Name: "create_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdRUserFollowingTable holds the schema information for the "rd_r_user_following" table. RdRUserFollowingTable = &schema.Table{ Name: "rd_r_user_following", Columns: RdRUserFollowingColumns, PrimaryKey: []*schema.Column{RdRUserFollowingColumns[0]}, } // RdUserColumns holds the columns for the "rd_user" table. RdUserColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt32, Increment: true}, {Name: "nick", Type: field.TypeString}, {Name: "status", Type: field.TypeInt32, Default: 1}, {Name: "create_time", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, } // RdUserTable holds the schema information for the "rd_user" table. RdUserTable = &schema.Table{ Name: "rd_user", Columns: RdUserColumns, PrimaryKey: []*schema.Column{RdUserColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ RdMessageTable, RdMomentTable, RdRMomentsFollowingTable, RdRUserFollowersTable, RdRUserFollowingTable, RdUserTable, } )
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.