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 ( // CareerSkillsColumns holds the columns for the "career_skills" table. CareerSkillsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "version", Type: field.TypeString, Nullable: true}, {Name: "career_skill_group_id", Type: field.TypeInt}, {Name: "skill_id", Type: field.TypeInt}, } // CareerSkillsTable holds the schema information for the "career_skills" table. CareerSkillsTable = &schema.Table{ Name: "career_skills", Columns: CareerSkillsColumns, PrimaryKey: []*schema.Column{CareerSkillsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "career_skills_career_skill_groups_careerSkills", Columns: []*schema.Column{CareerSkillsColumns[4]}, RefColumns: []*schema.Column{CareerSkillGroupsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "career_skills_skills_careerSkills", Columns: []*schema.Column{CareerSkillsColumns[5]}, RefColumns: []*schema.Column{SkillsColumns[0]}, OnDelete: schema.NoAction, }, }, } // CareerSkillGroupsColumns holds the columns for the "career_skill_groups" table. CareerSkillGroupsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "label", Type: field.TypeString}, {Name: "career_id", Type: field.TypeInt}, } // CareerSkillGroupsTable holds the schema information for the "career_skill_groups" table. CareerSkillGroupsTable = &schema.Table{ Name: "career_skill_groups", Columns: CareerSkillGroupsColumns, PrimaryKey: []*schema.Column{CareerSkillGroupsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "career_skill_groups_user_careers_careerSkillGroups", Columns: []*schema.Column{CareerSkillGroupsColumns[4]}, RefColumns: []*schema.Column{UserCareersColumns[0]}, OnDelete: schema.NoAction, }, }, } // CareerTasksColumns holds the columns for the "career_tasks" table. CareerTasksColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "career_id", Type: field.TypeInt}, } // CareerTasksTable holds the schema information for the "career_tasks" table. CareerTasksTable = &schema.Table{ Name: "career_tasks", Columns: CareerTasksColumns, PrimaryKey: []*schema.Column{CareerTasksColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "career_tasks_user_careers_careerTasks", Columns: []*schema.Column{CareerTasksColumns[4]}, RefColumns: []*schema.Column{UserCareersColumns[0]}, OnDelete: schema.NoAction, }, }, } // CareerTaskDescriptionsColumns holds the columns for the "career_task_descriptions" table. CareerTaskDescriptionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "description", Type: field.TypeString}, {Name: "career_task_id", Type: field.TypeInt}, } // CareerTaskDescriptionsTable holds the schema information for the "career_task_descriptions" table. CareerTaskDescriptionsTable = &schema.Table{ Name: "career_task_descriptions", Columns: CareerTaskDescriptionsColumns, PrimaryKey: []*schema.Column{CareerTaskDescriptionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "career_task_descriptions_career_tasks_careerTaskDescriptions", Columns: []*schema.Column{CareerTaskDescriptionsColumns[2]}, RefColumns: []*schema.Column{CareerTasksColumns[0]}, OnDelete: schema.NoAction, }, }, } // SkillsColumns holds the columns for the "skills" table. SkillsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "tag_id", Type: field.TypeInt}, } // SkillsTable holds the schema information for the "skills" table. SkillsTable = &schema.Table{ Name: "skills", Columns: SkillsColumns, PrimaryKey: []*schema.Column{SkillsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "skills_skill_tags_skills", Columns: []*schema.Column{SkillsColumns[5]}, RefColumns: []*schema.Column{SkillTagsColumns[0]}, OnDelete: schema.NoAction, }, }, } // SkillTagsColumns holds the columns for the "skill_tags" table. SkillTagsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "order", Type: field.TypeInt, Default: 0}, } // SkillTagsTable holds the schema information for the "skill_tags" table. SkillTagsTable = &schema.Table{ Name: "skill_tags", Columns: SkillTagsColumns, PrimaryKey: []*schema.Column{SkillTagsColumns[0]}, } // UsersColumns holds the columns for the "users" table. UsersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "nickname", Type: field.TypeString, Nullable: true}, {Name: "avatar_url", Type: field.TypeString, Nullable: true}, {Name: "birthday_year", Type: field.TypeInt}, {Name: "birthday_month", Type: field.TypeInt}, {Name: "birthday_day", Type: field.TypeInt}, {Name: "job", Type: field.TypeString, Nullable: true}, {Name: "belong_to", Type: field.TypeString, Nullable: true}, {Name: "pr", Type: field.TypeString, Nullable: true}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{ Name: "users", Columns: UsersColumns, PrimaryKey: []*schema.Column{UsersColumns[0]}, } // UserActivitiesColumns holds the columns for the "user_activities" table. UserActivitiesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "icon", Type: field.TypeString, Nullable: true}, {Name: "user_id", Type: field.TypeInt}, } // UserActivitiesTable holds the schema information for the "user_activities" table. UserActivitiesTable = &schema.Table{ Name: "user_activities", Columns: UserActivitiesColumns, PrimaryKey: []*schema.Column{UserActivitiesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_activities_users_activities", Columns: []*schema.Column{UserActivitiesColumns[6]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserAppealsColumns holds the columns for the "user_appeals" table. UserAppealsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "content", Type: field.TypeString}, {Name: "user_id", Type: field.TypeInt}, } // UserAppealsTable holds the schema information for the "user_appeals" table. UserAppealsTable = &schema.Table{ Name: "user_appeals", Columns: UserAppealsColumns, PrimaryKey: []*schema.Column{UserAppealsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_appeals_users_appeals", Columns: []*schema.Column{UserAppealsColumns[4]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserCareersColumns holds the columns for the "user_careers" table. UserCareersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "from", Type: field.TypeString}, {Name: "to", Type: field.TypeString, Nullable: true}, {Name: "career_group_id", Type: field.TypeInt}, } // UserCareersTable holds the schema information for the "user_careers" table. UserCareersTable = &schema.Table{ Name: "user_careers", Columns: UserCareersColumns, PrimaryKey: []*schema.Column{UserCareersColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_careers_user_career_groups_careers", Columns: []*schema.Column{UserCareersColumns[6]}, RefColumns: []*schema.Column{UserCareerGroupsColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserCareerDescriptionsColumns holds the columns for the "user_career_descriptions" table. UserCareerDescriptionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "description", Type: field.TypeString}, {Name: "career_id", Type: field.TypeInt}, } // UserCareerDescriptionsTable holds the schema information for the "user_career_descriptions" table. UserCareerDescriptionsTable = &schema.Table{ Name: "user_career_descriptions", Columns: UserCareerDescriptionsColumns, PrimaryKey: []*schema.Column{UserCareerDescriptionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_career_descriptions_user_careers_careerDescriptions", Columns: []*schema.Column{UserCareerDescriptionsColumns[2]}, RefColumns: []*schema.Column{UserCareersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserCareerGroupsColumns holds the columns for the "user_career_groups" table. UserCareerGroupsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "label", Type: field.TypeString}, {Name: "user_id", Type: field.TypeInt}, } // UserCareerGroupsTable holds the schema information for the "user_career_groups" table. UserCareerGroupsTable = &schema.Table{ Name: "user_career_groups", Columns: UserCareerGroupsColumns, PrimaryKey: []*schema.Column{UserCareerGroupsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_career_groups_users_careerGroups", Columns: []*schema.Column{UserCareerGroupsColumns[4]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserNotesColumns holds the columns for the "user_notes" table. UserNotesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "label", Type: field.TypeString}, {Name: "memo", Type: field.TypeString, Nullable: true}, {Name: "user_id", Type: field.TypeInt}, } // UserNotesTable holds the schema information for the "user_notes" table. UserNotesTable = &schema.Table{ Name: "user_notes", Columns: UserNotesColumns, PrimaryKey: []*schema.Column{UserNotesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_notes_users_notes", Columns: []*schema.Column{UserNotesColumns[5]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserNoteItemsColumns holds the columns for the "user_note_items" table. UserNoteItemsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "text", Type: field.TypeString}, {Name: "user_note_id", Type: field.TypeInt}, } // UserNoteItemsTable holds the schema information for the "user_note_items" table. UserNoteItemsTable = &schema.Table{ Name: "user_note_items", Columns: UserNoteItemsColumns, PrimaryKey: []*schema.Column{UserNoteItemsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_note_items_user_notes_noteItems", Columns: []*schema.Column{UserNoteItemsColumns[4]}, RefColumns: []*schema.Column{UserNotesColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserQualificationsColumns holds the columns for the "user_qualifications" table. UserQualificationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "name", Type: field.TypeString}, {Name: "organization", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "got_date", Type: field.TypeString, Nullable: true}, {Name: "memo", Type: field.TypeString, Nullable: true}, {Name: "user_id", Type: field.TypeInt}, } // UserQualificationsTable holds the schema information for the "user_qualifications" table. UserQualificationsTable = &schema.Table{ Name: "user_qualifications", Columns: UserQualificationsColumns, PrimaryKey: []*schema.Column{UserQualificationsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_qualifications_users_qualifications", Columns: []*schema.Column{UserQualificationsColumns[8]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // UserSolutionsColumns holds the columns for the "user_solutions" table. UserSolutionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "content", Type: field.TypeString}, {Name: "user_id", Type: field.TypeInt}, } // UserSolutionsTable holds the schema information for the "user_solutions" table. UserSolutionsTable = &schema.Table{ Name: "user_solutions", Columns: UserSolutionsColumns, PrimaryKey: []*schema.Column{UserSolutionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "user_solutions_users_solutions", Columns: []*schema.Column{UserSolutionsColumns[4]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.NoAction, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ CareerSkillsTable, CareerSkillGroupsTable, CareerTasksTable, CareerTaskDescriptionsTable, SkillsTable, SkillTagsTable, UsersTable, UserActivitiesTable, UserAppealsTable, UserCareersTable, UserCareerDescriptionsTable, UserCareerGroupsTable, UserNotesTable, UserNoteItemsTable, UserQualificationsTable, UserSolutionsTable, } )
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.