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 true. WithFixture = schema.WithFixture )
View Source
var ( // JiangHuRensColumns holds the columns for the "jiang_hu_rens" table. JiangHuRensColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "age", Type: field.TypeUint}, {Name: "sex", Type: field.TypeBool}, {Name: "jiang_hu_ren_spouse", Type: field.TypeInt, Unique: true, Nullable: true}, {Name: "jiang_hu_ren_apprentices", Type: field.TypeInt, Nullable: true}, {Name: "men_pai_disciples", Type: field.TypeInt, Nullable: true}, } // JiangHuRensTable holds the schema information for the "jiang_hu_rens" table. JiangHuRensTable = &schema.Table{ Name: "jiang_hu_rens", Columns: JiangHuRensColumns, PrimaryKey: []*schema.Column{JiangHuRensColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "jiang_hu_rens_jiang_hu_rens_spouse", Columns: []*schema.Column{JiangHuRensColumns[6]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "jiang_hu_rens_jiang_hu_rens_apprentices", Columns: []*schema.Column{JiangHuRensColumns[7]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "jiang_hu_rens_men_pais_disciples", Columns: []*schema.Column{JiangHuRensColumns[8]}, RefColumns: []*schema.Column{MenPaisColumns[0]}, OnDelete: schema.SetNull, }, }, } // MenPaisColumns holds the columns for the "men_pais" table. MenPaisColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "address", Type: field.TypeString, Default: ""}, } // MenPaisTable holds the schema information for the "men_pais" table. MenPaisTable = &schema.Table{ Name: "men_pais", Columns: MenPaisColumns, PrimaryKey: []*schema.Column{MenPaisColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // WeaponsColumns holds the columns for the "weapons" table. WeaponsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "level", Type: field.TypeInt}, {Name: "category", Type: field.TypeInt}, {Name: "jiang_hu_ren_weapon", Type: field.TypeInt, Unique: true, Nullable: true}, } // WeaponsTable holds the schema information for the "weapons" table. WeaponsTable = &schema.Table{ Name: "weapons", Columns: WeaponsColumns, PrimaryKey: []*schema.Column{WeaponsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "weapons_jiang_hu_rens_weapon", Columns: []*schema.Column{WeaponsColumns[6]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.SetNull, }, }, } // WuGongsColumns holds the columns for the "wu_gongs" table. WuGongsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "damage", Type: field.TypeInt}, {Name: "level", Type: field.TypeUint8}, } // WuGongsTable holds the schema information for the "wu_gongs" table. WuGongsTable = &schema.Table{ Name: "wu_gongs", Columns: WuGongsColumns, PrimaryKey: []*schema.Column{WuGongsColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } // JiangHuRenFollowingColumns holds the columns for the "jiang_hu_ren_following" table. JiangHuRenFollowingColumns = []*schema.Column{ {Name: "jiang_hu_ren_id", Type: field.TypeInt}, {Name: "follower_id", Type: field.TypeInt}, } // JiangHuRenFollowingTable holds the schema information for the "jiang_hu_ren_following" table. JiangHuRenFollowingTable = &schema.Table{ Name: "jiang_hu_ren_following", Columns: JiangHuRenFollowingColumns, PrimaryKey: []*schema.Column{JiangHuRenFollowingColumns[0], JiangHuRenFollowingColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "jiang_hu_ren_following_jiang_hu_ren_id", Columns: []*schema.Column{JiangHuRenFollowingColumns[0]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "jiang_hu_ren_following_follower_id", Columns: []*schema.Column{JiangHuRenFollowingColumns[1]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.Cascade, }, }, } // JiangHuRenFriendsColumns holds the columns for the "jiang_hu_ren_friends" table. JiangHuRenFriendsColumns = []*schema.Column{ {Name: "jiang_hu_ren_id", Type: field.TypeInt}, {Name: "friend_id", Type: field.TypeInt}, } // JiangHuRenFriendsTable holds the schema information for the "jiang_hu_ren_friends" table. JiangHuRenFriendsTable = &schema.Table{ Name: "jiang_hu_ren_friends", Columns: JiangHuRenFriendsColumns, PrimaryKey: []*schema.Column{JiangHuRenFriendsColumns[0], JiangHuRenFriendsColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "jiang_hu_ren_friends_jiang_hu_ren_id", Columns: []*schema.Column{JiangHuRenFriendsColumns[0]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "jiang_hu_ren_friends_friend_id", Columns: []*schema.Column{JiangHuRenFriendsColumns[1]}, RefColumns: []*schema.Column{JiangHuRensColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ JiangHuRensTable, MenPaisTable, WeaponsTable, WuGongsTable, JiangHuRenFollowingTable, JiangHuRenFriendsTable, } )
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.