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 ( // CommentsColumns holds the columns for the "comments" table. CommentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString, Nullable: true}, {Name: "commentable_type", Type: field.TypeString, Nullable: true}, {Name: "commentable_id", Type: field.TypeString, Nullable: true}, {Name: "body", Type: field.TypeString, Nullable: true}, {Name: "user_id", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // CommentsTable holds the schema information for the "comments" table. CommentsTable = &schema.Table{ Name: "comments", Columns: CommentsColumns, PrimaryKey: []*schema.Column{CommentsColumns[0]}, Indexes: []*schema.Index{ { Name: "comment_product", Unique: false, Columns: []*schema.Column{CommentsColumns[1]}, }, { Name: "comment_commentable_type_commentable_id", Unique: false, Columns: []*schema.Column{CommentsColumns[2], CommentsColumns[3]}, }, { Name: "comment_user_id", Unique: false, Columns: []*schema.Column{CommentsColumns[5]}, }, }, } // EpicsColumns holds the columns for the "epics" table. EpicsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "progress", Type: field.TypeFloat64, Nullable: true}, {Name: "start_date", Type: field.TypeString, Nullable: true}, {Name: "due_date", Type: field.TypeString, Nullable: true}, {Name: "release", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // EpicsTable holds the schema information for the "epics" table. EpicsTable = &schema.Table{ Name: "epics", Columns: EpicsColumns, PrimaryKey: []*schema.Column{EpicsColumns[0]}, Indexes: []*schema.Index{ { Name: "epic_product", Unique: false, Columns: []*schema.Column{EpicsColumns[1]}, }, }, } // FeaturesColumns holds the columns for the "features" table. FeaturesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "assigned_to", Type: field.TypeString, Nullable: true}, {Name: "start_date", Type: field.TypeString, Nullable: true}, {Name: "due_date", Type: field.TypeString, Nullable: true}, {Name: "release", Type: field.TypeString, Nullable: true}, {Name: "release_id", Type: field.TypeString, Nullable: true}, {Name: "release_reference_num", Type: field.TypeString, Nullable: true}, {Name: "tags", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // FeaturesTable holds the schema information for the "features" table. FeaturesTable = &schema.Table{ Name: "features", Columns: FeaturesColumns, PrimaryKey: []*schema.Column{FeaturesColumns[0]}, Indexes: []*schema.Index{ { Name: "feature_product", Unique: false, Columns: []*schema.Column{FeaturesColumns[1]}, }, { Name: "feature_status", Unique: false, Columns: []*schema.Column{FeaturesColumns[5]}, }, { Name: "feature_updated_at", Unique: false, Columns: []*schema.Column{FeaturesColumns[15]}, }, { Name: "feature_release_id", Unique: false, Columns: []*schema.Column{FeaturesColumns[10]}, }, { Name: "feature_release_reference_num", Unique: false, Columns: []*schema.Column{FeaturesColumns[11]}, }, }, } // GoalsColumns holds the columns for the "goals" table. GoalsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "progress", Type: field.TypeFloat64, Nullable: true}, {Name: "start_date", Type: field.TypeString, Nullable: true}, {Name: "end_date", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // GoalsTable holds the schema information for the "goals" table. GoalsTable = &schema.Table{ Name: "goals", Columns: GoalsColumns, PrimaryKey: []*schema.Column{GoalsColumns[0]}, Indexes: []*schema.Index{ { Name: "goal_product", Unique: false, Columns: []*schema.Column{GoalsColumns[1]}, }, }, } // IdeasColumns holds the columns for the "ideas" table. IdeasColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "votes", Type: field.TypeInt, Nullable: true, Default: 0}, {Name: "tags", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // IdeasTable holds the schema information for the "ideas" table. IdeasTable = &schema.Table{ Name: "ideas", Columns: IdeasColumns, PrimaryKey: []*schema.Column{IdeasColumns[0]}, Indexes: []*schema.Index{ { Name: "idea_product", Unique: false, Columns: []*schema.Column{IdeasColumns[1]}, }, { Name: "idea_status", Unique: false, Columns: []*schema.Column{IdeasColumns[5]}, }, { Name: "idea_votes", Unique: false, Columns: []*schema.Column{IdeasColumns[6]}, }, }, } // IdeaEndorsementsColumns holds the columns for the "idea_endorsements" table. IdeaEndorsementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString, Nullable: true}, {Name: "idea_id", Type: field.TypeString, Nullable: true}, {Name: "weight", Type: field.TypeInt, Nullable: true, Default: 1}, {Name: "value", Type: field.TypeString, Nullable: true}, {Name: "link", Type: field.TypeString, Nullable: true}, {Name: "portal_user_id", Type: field.TypeString, Nullable: true}, {Name: "portal_user_name", Type: field.TypeString, Nullable: true}, {Name: "portal_user_email", Type: field.TypeString, Nullable: true}, {Name: "portal_user_created_at", Type: field.TypeTime, Nullable: true}, {Name: "idea_user_id", Type: field.TypeString, Nullable: true}, {Name: "idea_user_name", Type: field.TypeString, Nullable: true}, {Name: "idea_user_email", Type: field.TypeString, Nullable: true}, {Name: "idea_user_title", Type: field.TypeString, Nullable: true}, {Name: "idea_user_created_at", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, } // IdeaEndorsementsTable holds the schema information for the "idea_endorsements" table. IdeaEndorsementsTable = &schema.Table{ Name: "idea_endorsements", Columns: IdeaEndorsementsColumns, PrimaryKey: []*schema.Column{IdeaEndorsementsColumns[0]}, Indexes: []*schema.Index{ { Name: "ideaendorsement_idea_id", Unique: false, Columns: []*schema.Column{IdeaEndorsementsColumns[2]}, }, { Name: "ideaendorsement_portal_user_email", Unique: false, Columns: []*schema.Column{IdeaEndorsementsColumns[8]}, }, { Name: "ideaendorsement_product_idea_id", Unique: false, Columns: []*schema.Column{IdeaEndorsementsColumns[1], IdeaEndorsementsColumns[2]}, }, }, } // IdeaOrganizationsColumns holds the columns for the "idea_organizations" table. IdeaOrganizationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "email_domains", Type: field.TypeString, Nullable: true}, {Name: "revenue", Type: field.TypeFloat64, Nullable: true}, {Name: "endorsements_count", Type: field.TypeInt, Nullable: true, Default: 0}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, } // IdeaOrganizationsTable holds the schema information for the "idea_organizations" table. IdeaOrganizationsTable = &schema.Table{ Name: "idea_organizations", Columns: IdeaOrganizationsColumns, PrimaryKey: []*schema.Column{IdeaOrganizationsColumns[0]}, Indexes: []*schema.Index{ { Name: "ideaorganization_email_domains", Unique: false, Columns: []*schema.Column{IdeaOrganizationsColumns[4]}, }, { Name: "ideaorganization_reference_num", Unique: false, Columns: []*schema.Column{IdeaOrganizationsColumns[2]}, }, }, } // IdeaUsersColumns holds the columns for the "idea_users" table. IdeaUsersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "email", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "idea_organizations", Type: field.TypeJSON, Nullable: true}, } // IdeaUsersTable holds the schema information for the "idea_users" table. IdeaUsersTable = &schema.Table{ Name: "idea_users", Columns: IdeaUsersColumns, PrimaryKey: []*schema.Column{IdeaUsersColumns[0]}, Indexes: []*schema.Index{ { Name: "ideauser_email", Unique: false, Columns: []*schema.Column{IdeaUsersColumns[2]}, }, }, } // InitiativesColumns holds the columns for the "initiatives" table. InitiativesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "value", Type: field.TypeFloat64, Nullable: true}, {Name: "effort", Type: field.TypeFloat64, Nullable: true}, {Name: "progress", Type: field.TypeFloat64, Nullable: true}, {Name: "start_date", Type: field.TypeString, Nullable: true}, {Name: "end_date", Type: field.TypeString, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // InitiativesTable holds the schema information for the "initiatives" table. InitiativesTable = &schema.Table{ Name: "initiatives", Columns: InitiativesColumns, PrimaryKey: []*schema.Column{InitiativesColumns[0]}, Indexes: []*schema.Index{ { Name: "initiative_product", Unique: false, Columns: []*schema.Column{InitiativesColumns[1]}, }, }, } // ProductsColumns holds the columns for the "products" table. ProductsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "reference_prefix", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "product_line", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "has_ideas", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // ProductsTable holds the schema information for the "products" table. ProductsTable = &schema.Table{ Name: "products", Columns: ProductsColumns, PrimaryKey: []*schema.Column{ProductsColumns[0]}, } // RelationshipsColumns holds the columns for the "relationships" table. RelationshipsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "from_type", Type: field.TypeString}, {Name: "from_id", Type: field.TypeString}, {Name: "rel_type", Type: field.TypeString}, {Name: "to_type", Type: field.TypeString}, {Name: "to_id", Type: field.TypeString}, {Name: "product", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, } // RelationshipsTable holds the schema information for the "relationships" table. RelationshipsTable = &schema.Table{ Name: "relationships", Columns: RelationshipsColumns, PrimaryKey: []*schema.Column{RelationshipsColumns[0]}, Indexes: []*schema.Index{ { Name: "relationship_from_type_from_id_rel_type_to_type_to_id", Unique: true, Columns: []*schema.Column{RelationshipsColumns[1], RelationshipsColumns[2], RelationshipsColumns[3], RelationshipsColumns[4], RelationshipsColumns[5]}, }, { Name: "relationship_from_type_from_id", Unique: false, Columns: []*schema.Column{RelationshipsColumns[1], RelationshipsColumns[2]}, }, { Name: "relationship_to_type_to_id", Unique: false, Columns: []*schema.Column{RelationshipsColumns[4], RelationshipsColumns[5]}, }, { Name: "relationship_rel_type", Unique: false, Columns: []*schema.Column{RelationshipsColumns[3]}, }, { Name: "relationship_product", Unique: false, Columns: []*schema.Column{RelationshipsColumns[6]}, }, }, } // ReleasesColumns holds the columns for the "releases" table. ReleasesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "start_date", Type: field.TypeString, Nullable: true}, {Name: "release_date", Type: field.TypeString, Nullable: true}, {Name: "released", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "parking_lot", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // ReleasesTable holds the schema information for the "releases" table. ReleasesTable = &schema.Table{ Name: "releases", Columns: ReleasesColumns, PrimaryKey: []*schema.Column{ReleasesColumns[0]}, Indexes: []*schema.Index{ { Name: "release_product", Unique: false, Columns: []*schema.Column{ReleasesColumns[1]}, }, }, } // RequirementsColumns holds the columns for the "requirements" table. RequirementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "feature_id", Type: field.TypeString, Nullable: true}, {Name: "reference_num", Type: field.TypeString, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "status", Type: field.TypeString, Nullable: true}, {Name: "assigned_to", Type: field.TypeString, Nullable: true}, {Name: "position", Type: field.TypeInt, Nullable: true}, {Name: "original_estimate", Type: field.TypeFloat64, Nullable: true}, {Name: "remaining_estimate", Type: field.TypeFloat64, Nullable: true}, {Name: "work_done", Type: field.TypeFloat64, Nullable: true}, {Name: "url", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // RequirementsTable holds the schema information for the "requirements" table. RequirementsTable = &schema.Table{ Name: "requirements", Columns: RequirementsColumns, PrimaryKey: []*schema.Column{RequirementsColumns[0]}, Indexes: []*schema.Index{ { Name: "requirement_product", Unique: false, Columns: []*schema.Column{RequirementsColumns[1]}, }, { Name: "requirement_feature_id", Unique: false, Columns: []*schema.Column{RequirementsColumns[2]}, }, { Name: "requirement_status", Unique: false, Columns: []*schema.Column{RequirementsColumns[6]}, }, }, } // SavedFiltersColumns holds the columns for the "saved_filters" table. SavedFiltersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "aql", Type: field.TypeString}, {Name: "product", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "is_favorite", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // SavedFiltersTable holds the schema information for the "saved_filters" table. SavedFiltersTable = &schema.Table{ Name: "saved_filters", Columns: SavedFiltersColumns, PrimaryKey: []*schema.Column{SavedFiltersColumns[0]}, Indexes: []*schema.Index{ { Name: "savedfilter_is_favorite", Unique: false, Columns: []*schema.Column{SavedFiltersColumns[5]}, }, { Name: "savedfilter_product", Unique: false, Columns: []*schema.Column{SavedFiltersColumns[3]}, }, }, } // SyncMetaColumns holds the columns for the "sync_meta" table. SyncMetaColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "entity", Type: field.TypeString}, {Name: "product", Type: field.TypeString}, {Name: "last_sync", Type: field.TypeTime}, {Name: "record_count", Type: field.TypeInt, Nullable: true, Default: 0}, } // SyncMetaTable holds the schema information for the "sync_meta" table. SyncMetaTable = &schema.Table{ Name: "sync_meta", Columns: SyncMetaColumns, PrimaryKey: []*schema.Column{SyncMetaColumns[0]}, Indexes: []*schema.Index{ { Name: "syncmeta_entity_product", Unique: true, Columns: []*schema.Column{SyncMetaColumns[1], SyncMetaColumns[2]}, }, }, } // UsersColumns holds the columns for the "users" table. UsersColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "first_name", Type: field.TypeString, Nullable: true}, {Name: "last_name", Type: field.TypeString, Nullable: true}, {Name: "email", Type: field.TypeString, Nullable: true}, {Name: "role", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "data", Type: field.TypeJSON, Nullable: true}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{ Name: "users", Columns: UsersColumns, PrimaryKey: []*schema.Column{UsersColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ CommentsTable, EpicsTable, FeaturesTable, GoalsTable, IdeasTable, IdeaEndorsementsTable, IdeaOrganizationsTable, IdeaUsersTable, InitiativesTable, ProductsTable, RelationshipsTable, ReleasesTable, RequirementsTable, SavedFiltersTable, SyncMetaTable, UsersTable, } )
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.