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 ( // CustomFieldDefsColumns holds the columns for the "custom_field_defs" table. CustomFieldDefsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "provider", Type: field.TypeString, Size: 64}, {Name: "key", Type: field.TypeString, Size: 191}, {Name: "name", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "field_type", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "kinds", Type: field.TypeJSON, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "synced_at", Type: field.TypeTime}, } // CustomFieldDefsTable holds the schema information for the "custom_field_defs" table. CustomFieldDefsTable = &schema.Table{ Name: "custom_field_defs", Columns: CustomFieldDefsColumns, PrimaryKey: []*schema.Column{CustomFieldDefsColumns[0]}, Indexes: []*schema.Index{ { Name: "customfielddef_provider_key", Unique: true, Columns: []*schema.Column{CustomFieldDefsColumns[1], CustomFieldDefsColumns[2]}, }, }, } // DimensionOptionsColumns holds the columns for the "dimension_options" table. DimensionOptionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 384}, {Name: "dimension_row_id", Type: field.TypeString, Size: 320}, {Name: "option_id", Type: field.TypeString, Size: 191}, {Name: "label", Type: field.TypeString, Size: 255}, {Name: "questions", Type: field.TypeJSON, Nullable: true}, {Name: "sequence", Type: field.TypeInt, Default: 0}, } // DimensionOptionsTable holds the schema information for the "dimension_options" table. DimensionOptionsTable = &schema.Table{ Name: "dimension_options", Columns: DimensionOptionsColumns, PrimaryKey: []*schema.Column{DimensionOptionsColumns[0]}, Indexes: []*schema.Index{ { Name: "dimensionoption_dimension_row_id", Unique: false, Columns: []*schema.Column{DimensionOptionsColumns[1]}, }, { Name: "dimensionoption_dimension_row_id_option_id", Unique: true, Columns: []*schema.Column{DimensionOptionsColumns[1], DimensionOptionsColumns[2]}, }, }, } // EvidencesColumns holds the columns for the "evidences" table. EvidencesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 64}, {Name: "system", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "sensitivity", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "captured_by", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "captured_at", Type: field.TypeTime, Nullable: true}, {Name: "source_uri", Type: field.TypeString, Nullable: true, Size: 2048}, {Name: "verified", Type: field.TypeBool, Default: false}, {Name: "canonical", Type: field.TypeJSON}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // EvidencesTable holds the schema information for the "evidences" table. EvidencesTable = &schema.Table{ Name: "evidences", Columns: EvidencesColumns, PrimaryKey: []*schema.Column{EvidencesColumns[0]}, Indexes: []*schema.Index{ { Name: "evidence_system", Unique: false, Columns: []*schema.Column{EvidencesColumns[1]}, }, { Name: "evidence_captured_at", Unique: false, Columns: []*schema.Column{EvidencesColumns[4]}, }, { Name: "evidence_verified", Unique: false, Columns: []*schema.Column{EvidencesColumns[6]}, }, }, } // ItemsColumns holds the columns for the "items" table. ItemsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "provider", Type: field.TypeString, Size: 64}, {Name: "source_id", Type: field.TypeString, Size: 191}, {Name: "source_ref", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "source_url", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "workspace_ref", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "kind", Type: field.TypeString, Size: 32}, {Name: "name", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "status_id", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "status_name", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "status_category", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "status_complete", Type: field.TypeBool, Default: false}, {Name: "progress", Type: field.TypeFloat64, Nullable: true}, {Name: "parent_id", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "release_id", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "start_date", Type: field.TypeTime, Nullable: true}, {Name: "due_date", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "owner_id", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "owner_name", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "owner_email", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "moscow", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "kano", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "rice", Type: field.TypeJSON, Nullable: true}, {Name: "tags", Type: field.TypeJSON, Nullable: true}, {Name: "custom_fields", Type: field.TypeJSON, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "synced_at", Type: field.TypeTime}, } // ItemsTable holds the schema information for the "items" table. ItemsTable = &schema.Table{ Name: "items", Columns: ItemsColumns, PrimaryKey: []*schema.Column{ItemsColumns[0]}, Indexes: []*schema.Index{ { Name: "item_provider", Unique: false, Columns: []*schema.Column{ItemsColumns[1]}, }, { Name: "item_kind", Unique: false, Columns: []*schema.Column{ItemsColumns[6]}, }, { Name: "item_provider_kind", Unique: false, Columns: []*schema.Column{ItemsColumns[1], ItemsColumns[6]}, }, { Name: "item_provider_source_ref", Unique: false, Columns: []*schema.Column{ItemsColumns[1], ItemsColumns[3]}, }, { Name: "item_provider_workspace_ref", Unique: false, Columns: []*schema.Column{ItemsColumns[1], ItemsColumns[5]}, }, { Name: "item_status_category", Unique: false, Columns: []*schema.Column{ItemsColumns[11]}, }, { Name: "item_moscow", Unique: false, Columns: []*schema.Column{ItemsColumns[23]}, }, { Name: "item_release_id", Unique: false, Columns: []*schema.Column{ItemsColumns[15]}, }, }, } // ItemAugmentsColumns holds the columns for the "item_augments" table. ItemAugmentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "provider", Type: field.TypeString, Size: 64}, {Name: "source_ref", Type: field.TypeString, Size: 191}, {Name: "moscow", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "kano", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "rice", Type: field.TypeJSON, Nullable: true}, {Name: "okr_refs", Type: field.TypeJSON, Nullable: true}, {Name: "notes", Type: field.TypeString, Nullable: true, Size: 2147483647}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "updated_at", Type: field.TypeTime}, } // ItemAugmentsTable holds the schema information for the "item_augments" table. ItemAugmentsTable = &schema.Table{ Name: "item_augments", Columns: ItemAugmentsColumns, PrimaryKey: []*schema.Column{ItemAugmentsColumns[0]}, Indexes: []*schema.Index{ { Name: "itemaugment_provider_source_ref", Unique: true, Columns: []*schema.Column{ItemAugmentsColumns[1], ItemAugmentsColumns[2]}, }, }, } // OpportunityAssessmentsColumns holds the columns for the "opportunity_assessments" table. OpportunityAssessmentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 64}, {Name: "opportunity_spec_id", Type: field.TypeString, Size: 255}, {Name: "rmi_id", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "title", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "cycle_number", Type: field.TypeInt, Default: 1}, {Name: "assessed_at", Type: field.TypeTime}, {Name: "supersedes_id", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "current", Type: field.TypeBool, Default: true}, {Name: "moscow_class", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "rice_score", Type: field.TypeFloat64, Nullable: true}, {Name: "rice_computable", Type: field.TypeBool, Default: false}, {Name: "opportunity_rank_calculated", Type: field.TypeInt, Nullable: true}, {Name: "opportunity_rank_final", Type: field.TypeInt, Nullable: true}, {Name: "kano_category", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "mih_category", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "compass_profile_id", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "canonical", Type: field.TypeJSON}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // OpportunityAssessmentsTable holds the schema information for the "opportunity_assessments" table. OpportunityAssessmentsTable = &schema.Table{ Name: "opportunity_assessments", Columns: OpportunityAssessmentsColumns, PrimaryKey: []*schema.Column{OpportunityAssessmentsColumns[0]}, Indexes: []*schema.Index{ { Name: "opportunityassessment_opportunity_spec_id", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[1]}, }, { Name: "opportunityassessment_opportunity_spec_id_current", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[1], OpportunityAssessmentsColumns[7]}, }, { Name: "opportunityassessment_rmi_id", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[2]}, }, { Name: "opportunityassessment_current", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[7]}, }, { Name: "opportunityassessment_moscow_class", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[8]}, }, { Name: "opportunityassessment_kano_category", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[13]}, }, { Name: "opportunityassessment_mih_category", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[14]}, }, { Name: "opportunityassessment_compass_profile_id", Unique: false, Columns: []*schema.Column{OpportunityAssessmentsColumns[15]}, }, }, } // OpportunitySpecsColumns holds the columns for the "opportunity_specs" table. OpportunitySpecsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "title", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "canonical", Type: field.TypeJSON}, } // OpportunitySpecsTable holds the schema information for the "opportunity_specs" table. OpportunitySpecsTable = &schema.Table{ Name: "opportunity_specs", Columns: OpportunitySpecsColumns, PrimaryKey: []*schema.Column{OpportunitySpecsColumns[0]}, Indexes: []*schema.Index{ { Name: "opportunityspec_title", Unique: false, Columns: []*schema.Column{OpportunitySpecsColumns[1]}, }, }, } // PortfolioDimensionsColumns holds the columns for the "portfolio_dimensions" table. PortfolioDimensionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 320}, {Name: "dimension_id", Type: field.TypeString, Size: 191}, {Name: "version", Type: field.TypeString, Size: 64}, {Name: "name", Type: field.TypeString, Size: 255}, {Name: "kind", Type: field.TypeString, Size: 32}, {Name: "built_in", Type: field.TypeBool, Default: false}, {Name: "created_at", Type: field.TypeTime}, } // PortfolioDimensionsTable holds the schema information for the "portfolio_dimensions" table. PortfolioDimensionsTable = &schema.Table{ Name: "portfolio_dimensions", Columns: PortfolioDimensionsColumns, PrimaryKey: []*schema.Column{PortfolioDimensionsColumns[0]}, Indexes: []*schema.Index{ { Name: "portfoliodimension_dimension_id", Unique: false, Columns: []*schema.Column{PortfolioDimensionsColumns[1]}, }, { Name: "portfoliodimension_dimension_id_version", Unique: true, Columns: []*schema.Column{PortfolioDimensionsColumns[1], PortfolioDimensionsColumns[2]}, }, { Name: "portfoliodimension_built_in", Unique: false, Columns: []*schema.Column{PortfolioDimensionsColumns[5]}, }, }, } // ProfileAssignmentsColumns holds the columns for the "profile_assignments" table. ProfileAssignmentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "profile_id", Type: field.TypeString, Size: 64}, {Name: "secondary", Type: field.TypeJSON, Nullable: true}, {Name: "rationale", Type: field.TypeString, Size: 2147483647}, {Name: "proposed_by", Type: field.TypeString, Size: 255}, {Name: "status", Type: field.TypeString, Size: 32}, {Name: "confirmed_by", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "confirmed_at", Type: field.TypeTime, Nullable: true}, {Name: "evidence_ids", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // ProfileAssignmentsTable holds the schema information for the "profile_assignments" table. ProfileAssignmentsTable = &schema.Table{ Name: "profile_assignments", Columns: ProfileAssignmentsColumns, PrimaryKey: []*schema.Column{ProfileAssignmentsColumns[0]}, Indexes: []*schema.Index{ { Name: "profileassignment_profile_id", Unique: false, Columns: []*schema.Column{ProfileAssignmentsColumns[1]}, }, { Name: "profileassignment_status", Unique: false, Columns: []*schema.Column{ProfileAssignmentsColumns[5]}, }, }, } // RankOverridesColumns holds the columns for the "rank_overrides" table. RankOverridesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 64}, {Name: "final_rank", Type: field.TypeInt}, {Name: "rationale", Type: field.TypeString, Size: 2147483647}, {Name: "approved_by", Type: field.TypeString, Size: 255}, {Name: "evidence_ids", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // RankOverridesTable holds the schema information for the "rank_overrides" table. RankOverridesTable = &schema.Table{ Name: "rank_overrides", Columns: RankOverridesColumns, PrimaryKey: []*schema.Column{RankOverridesColumns[0]}, Indexes: []*schema.Index{ { Name: "rankoverride_created_at", Unique: false, Columns: []*schema.Column{RankOverridesColumns[5]}, }, }, } // ReleasesColumns holds the columns for the "releases" table. ReleasesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "provider", Type: field.TypeString, Size: 64}, {Name: "source_id", Type: field.TypeString, Size: 191}, {Name: "source_ref", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "source_url", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "name", Type: field.TypeString, Nullable: true, Size: 512}, {Name: "start_date", Type: field.TypeTime, Nullable: true}, {Name: "release_date", Type: field.TypeTime, Nullable: true}, {Name: "released", Type: field.TypeBool, Default: false}, {Name: "status_id", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "status_name", Type: field.TypeString, Nullable: true, Size: 191}, {Name: "status_category", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "progress", Type: field.TypeFloat64, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "synced_at", Type: field.TypeTime}, } // 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_provider", Unique: false, Columns: []*schema.Column{ReleasesColumns[1]}, }, { Name: "release_released", Unique: false, Columns: []*schema.Column{ReleasesColumns[8]}, }, }, } // ReportDatasetsColumns holds the columns for the "report_datasets" table. ReportDatasetsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 64}, {Name: "generated_at", Type: field.TypeTime}, {Name: "ranking_policy_id", Type: field.TypeString, Size: 191}, {Name: "ranking_policy_version", Type: field.TypeString, Size: 64}, {Name: "status", Type: field.TypeString, Size: 32, Default: "draft"}, {Name: "canonical", Type: field.TypeJSON}, {Name: "created_at", Type: field.TypeTime}, } // ReportDatasetsTable holds the schema information for the "report_datasets" table. ReportDatasetsTable = &schema.Table{ Name: "report_datasets", Columns: ReportDatasetsColumns, PrimaryKey: []*schema.Column{ReportDatasetsColumns[0]}, Indexes: []*schema.Index{ { Name: "reportdataset_status", Unique: false, Columns: []*schema.Column{ReportDatasetsColumns[4]}, }, { Name: "reportdataset_generated_at", Unique: false, Columns: []*schema.Column{ReportDatasetsColumns[1]}, }, }, } // SyncMetaColumns holds the columns for the "sync_meta" table. SyncMetaColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "provider", Type: field.TypeString, Size: 64}, {Name: "kind", Type: field.TypeString, Size: 32}, {Name: "last_sync", Type: field.TypeTime}, {Name: "record_count", Type: field.TypeInt, 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_provider_kind", Unique: true, Columns: []*schema.Column{SyncMetaColumns[1], SyncMetaColumns[2]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ CustomFieldDefsTable, DimensionOptionsTable, EvidencesTable, ItemsTable, ItemAugmentsTable, OpportunityAssessmentsTable, OpportunitySpecsTable, PortfolioDimensionsTable, ProfileAssignmentsTable, RankOverridesTable, ReleasesTable, ReportDatasetsTable, SyncMetaTable, } )
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.