Documentation
¶
Index ¶
- Variables
- func Create(ctx context.Context, s *Schema, tables []*schema.Table, ...) error
- func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error
- func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error
- type Schema
- func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error
- func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error
- func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error
- func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error
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 ( // ApplicationsColumns holds the columns for the "applications" table. ApplicationsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "project_uuid", Type: field.TypeString, Default: "default"}, {Name: "version", Type: field.TypeString}, {Name: "chart_name", Type: field.TypeString}, {Name: "chart_version", Type: field.TypeString}, {Name: "kind", Type: field.TypeString, Nullable: true}, {Name: "application_default_profile", Type: field.TypeUint64, Nullable: true}, {Name: "registry_applications", Type: field.TypeUint64}, {Name: "registry_application_images", Type: field.TypeUint64, Nullable: true}, } // ApplicationsTable holds the schema information for the "applications" table. ApplicationsTable = &schema.Table{ Name: "applications", Columns: ApplicationsColumns, PrimaryKey: []*schema.Column{ApplicationsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "applications_profiles_default_profile", Columns: []*schema.Column{ApplicationsColumns[12]}, RefColumns: []*schema.Column{ProfilesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "applications_registries_applications", Columns: []*schema.Column{ApplicationsColumns[13]}, RefColumns: []*schema.Column{RegistriesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "applications_registries_application_images", Columns: []*schema.Column{ApplicationsColumns[14]}, RefColumns: []*schema.Column{RegistriesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "application_project_uuid_name_version", Unique: true, Columns: []*schema.Column{ApplicationsColumns[7], ApplicationsColumns[1], ApplicationsColumns[8]}, }, }, } // ApplicationDependenciesColumns holds the columns for the "application_dependencies" table. ApplicationDependenciesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "application_dependency_source_fk", Type: field.TypeUint64}, {Name: "application_dependency_target_fk", Type: field.TypeUint64}, {Name: "deployment_package_application_dependencies", Type: field.TypeUint64}, } // ApplicationDependenciesTable holds the schema information for the "application_dependencies" table. ApplicationDependenciesTable = &schema.Table{ Name: "application_dependencies", Columns: ApplicationDependenciesColumns, PrimaryKey: []*schema.Column{ApplicationDependenciesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "application_dependencies_applications_source_fk", Columns: []*schema.Column{ApplicationDependenciesColumns[1]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "application_dependencies_applications_target_fk", Columns: []*schema.Column{ApplicationDependenciesColumns[2]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "application_dependencies_deployment_packages_application_dependencies", Columns: []*schema.Column{ApplicationDependenciesColumns[3]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ApplicationNamespacesColumns holds the columns for the "application_namespaces" table. ApplicationNamespacesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "namespace", Type: field.TypeString}, {Name: "application_namespace_source_fk", Type: field.TypeUint64}, {Name: "deployment_package_application_namespaces", Type: field.TypeUint64}, } // ApplicationNamespacesTable holds the schema information for the "application_namespaces" table. ApplicationNamespacesTable = &schema.Table{ Name: "application_namespaces", Columns: ApplicationNamespacesColumns, PrimaryKey: []*schema.Column{ApplicationNamespacesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "application_namespaces_applications_source_fk", Columns: []*schema.Column{ApplicationNamespacesColumns[2]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "application_namespaces_deployment_packages_application_namespaces", Columns: []*schema.Column{ApplicationNamespacesColumns[3]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ArtifactsColumns holds the columns for the "artifacts" table. ArtifactsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "project_uuid", Type: field.TypeString, Default: "default"}, {Name: "mime_type", Type: field.TypeString}, {Name: "artifact", Type: field.TypeBytes}, } // ArtifactsTable holds the schema information for the "artifacts" table. ArtifactsTable = &schema.Table{ Name: "artifacts", Columns: ArtifactsColumns, PrimaryKey: []*schema.Column{ArtifactsColumns[0]}, Indexes: []*schema.Index{ { Name: "artifact_project_uuid_name", Unique: true, Columns: []*schema.Column{ArtifactsColumns[7], ArtifactsColumns[1]}, }, }, } // ArtifactReferencesColumns holds the columns for the "artifact_references" table. ArtifactReferencesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "purpose", Type: field.TypeString}, {Name: "artifact_reference_artifact", Type: field.TypeUint64}, {Name: "deployment_package_artifacts", Type: field.TypeUint64}, } // ArtifactReferencesTable holds the schema information for the "artifact_references" table. ArtifactReferencesTable = &schema.Table{ Name: "artifact_references", Columns: ArtifactReferencesColumns, PrimaryKey: []*schema.Column{ArtifactReferencesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "artifact_references_artifacts_artifact", Columns: []*schema.Column{ArtifactReferencesColumns[2]}, RefColumns: []*schema.Column{ArtifactsColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "artifact_references_deployment_packages_artifacts", Columns: []*schema.Column{ArtifactReferencesColumns[3]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, } // CommonMixinsColumns holds the columns for the "common_mixins" table. CommonMixinsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, } // CommonMixinsTable holds the schema information for the "common_mixins" table. CommonMixinsTable = &schema.Table{ Name: "common_mixins", Columns: CommonMixinsColumns, PrimaryKey: []*schema.Column{CommonMixinsColumns[0]}, } // DeploymentPackagesColumns holds the columns for the "deployment_packages" table. DeploymentPackagesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "project_uuid", Type: field.TypeString, Default: "default"}, {Name: "version", Type: field.TypeString}, {Name: "is_deployed", Type: field.TypeBool, Nullable: true}, {Name: "is_visible", Type: field.TypeBool, Nullable: true}, {Name: "allows_multiple_deployments", Type: field.TypeBool, Nullable: true}, {Name: "kind", Type: field.TypeString, Nullable: true}, {Name: "deployment_package_default_profile", Type: field.TypeUint64, Nullable: true}, } // DeploymentPackagesTable holds the schema information for the "deployment_packages" table. DeploymentPackagesTable = &schema.Table{ Name: "deployment_packages", Columns: DeploymentPackagesColumns, PrimaryKey: []*schema.Column{DeploymentPackagesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_packages_deployment_profiles_default_profile", Columns: []*schema.Column{DeploymentPackagesColumns[13]}, RefColumns: []*schema.Column{DeploymentProfilesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "deploymentpackage_project_uuid_name_version", Unique: true, Columns: []*schema.Column{DeploymentPackagesColumns[7], DeploymentPackagesColumns[1], DeploymentPackagesColumns[8]}, }, }, } // DeploymentProfilesColumns holds the columns for the "deployment_profiles" table. DeploymentProfilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "deployment_package_deployment_profiles", Type: field.TypeUint64}, } // DeploymentProfilesTable holds the schema information for the "deployment_profiles" table. DeploymentProfilesTable = &schema.Table{ Name: "deployment_profiles", Columns: DeploymentProfilesColumns, PrimaryKey: []*schema.Column{DeploymentProfilesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_profiles_deployment_packages_deployment_profiles", Columns: []*schema.Column{DeploymentProfilesColumns[7]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "deploymentprofile_name_deployment_package_deployment_profiles", Unique: true, Columns: []*schema.Column{DeploymentProfilesColumns[1], DeploymentProfilesColumns[7]}, }, }, } // DeploymentRequirementsColumns holds the columns for the "deployment_requirements" table. DeploymentRequirementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "deployment_requirement_deployment_package_fk", Type: field.TypeUint64}, {Name: "deployment_requirement_deployment_profile_fk", Type: field.TypeUint64, Nullable: true}, {Name: "profile_deployment_requirements", Type: field.TypeUint64}, } // DeploymentRequirementsTable holds the schema information for the "deployment_requirements" table. DeploymentRequirementsTable = &schema.Table{ Name: "deployment_requirements", Columns: DeploymentRequirementsColumns, PrimaryKey: []*schema.Column{DeploymentRequirementsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_requirements_deployment_packages_deployment_package_fk", Columns: []*schema.Column{DeploymentRequirementsColumns[1]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "deployment_requirements_deployment_profiles_deployment_profile_fk", Columns: []*schema.Column{DeploymentRequirementsColumns[2]}, RefColumns: []*schema.Column{DeploymentProfilesColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "deployment_requirements_profiles_deployment_requirements", Columns: []*schema.Column{DeploymentRequirementsColumns[3]}, RefColumns: []*schema.Column{ProfilesColumns[0]}, OnDelete: schema.Cascade, }, }, } // EndpointsColumns holds the columns for the "endpoints" table. EndpointsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "service_name", Type: field.TypeString}, {Name: "external_path", Type: field.TypeString}, {Name: "internal_path", Type: field.TypeString}, {Name: "scheme", Type: field.TypeString}, {Name: "auth_type", Type: field.TypeString}, {Name: "app_name", Type: field.TypeString, Nullable: true}, {Name: "extension_endpoints", Type: field.TypeUint64}, } // EndpointsTable holds the schema information for the "endpoints" table. EndpointsTable = &schema.Table{ Name: "endpoints", Columns: EndpointsColumns, PrimaryKey: []*schema.Column{EndpointsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "endpoints_extensions_endpoints", Columns: []*schema.Column{EndpointsColumns[7]}, RefColumns: []*schema.Column{ExtensionsColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "endpoint_service_name_extension_endpoints", Unique: true, Columns: []*schema.Column{EndpointsColumns[1], EndpointsColumns[7]}, }, }, } // ExtensionsColumns holds the columns for the "extensions" table. ExtensionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "version", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "ui_label", Type: field.TypeString, Nullable: true}, {Name: "ui_service_name", Type: field.TypeString, Nullable: true}, {Name: "ui_description", Type: field.TypeString, Nullable: true}, {Name: "ui_file_name", Type: field.TypeString, Nullable: true}, {Name: "ui_app_name", Type: field.TypeString, Nullable: true}, {Name: "ui_module_name", Type: field.TypeString, Nullable: true}, {Name: "deployment_package_extensions", Type: field.TypeUint64}, } // ExtensionsTable holds the schema information for the "extensions" table. ExtensionsTable = &schema.Table{ Name: "extensions", Columns: ExtensionsColumns, PrimaryKey: []*schema.Column{ExtensionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "extensions_deployment_packages_extensions", Columns: []*schema.Column{ExtensionsColumns[12]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "extension_name_version_deployment_package_extensions", Unique: true, Columns: []*schema.Column{ExtensionsColumns[1], ExtensionsColumns[2], ExtensionsColumns[12]}, }, }, } // IgnoredResourcesColumns holds the columns for the "ignored_resources" table. IgnoredResourcesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "kind", Type: field.TypeString}, {Name: "namespace", Type: field.TypeString}, {Name: "application_ignored_resources", Type: field.TypeUint64}, } // IgnoredResourcesTable holds the schema information for the "ignored_resources" table. IgnoredResourcesTable = &schema.Table{ Name: "ignored_resources", Columns: IgnoredResourcesColumns, PrimaryKey: []*schema.Column{IgnoredResourcesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "ignored_resources_applications_ignored_resources", Columns: []*schema.Column{IgnoredResourcesColumns[4]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "ignoredresource_name_kind_namespace_application_ignored_resources", Unique: true, Columns: []*schema.Column{IgnoredResourcesColumns[1], IgnoredResourcesColumns[2], IgnoredResourcesColumns[3], IgnoredResourcesColumns[4]}, }, }, } // NamespacesColumns holds the columns for the "namespaces" table. NamespacesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "deployment_package_namespaces", Type: field.TypeUint64}, } // NamespacesTable holds the schema information for the "namespaces" table. NamespacesTable = &schema.Table{ Name: "namespaces", Columns: NamespacesColumns, PrimaryKey: []*schema.Column{NamespacesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "namespaces_deployment_packages_namespaces", Columns: []*schema.Column{NamespacesColumns[2]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, }, } // NamespaceAdornmentsColumns holds the columns for the "namespace_adornments" table. NamespaceAdornmentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "type", Type: field.TypeString}, {Name: "key", Type: field.TypeString}, {Name: "value", Type: field.TypeString, Nullable: true}, {Name: "namespace_adornments", Type: field.TypeUint64}, } // NamespaceAdornmentsTable holds the schema information for the "namespace_adornments" table. NamespaceAdornmentsTable = &schema.Table{ Name: "namespace_adornments", Columns: NamespaceAdornmentsColumns, PrimaryKey: []*schema.Column{NamespaceAdornmentsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "namespace_adornments_namespaces_adornments", Columns: []*schema.Column{NamespaceAdornmentsColumns[4]}, RefColumns: []*schema.Column{NamespacesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ParameterTemplatesColumns holds the columns for the "parameter_templates" table. ParameterTemplatesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "default", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeString, Nullable: true}, {Name: "validator", Type: field.TypeString, Nullable: true}, {Name: "suggested_values", Type: field.TypeJSON, Nullable: true}, {Name: "mandatory", Type: field.TypeBool, Nullable: true}, {Name: "secret", Type: field.TypeBool, Nullable: true}, {Name: "profile_parameter_templates", Type: field.TypeUint64}, } // ParameterTemplatesTable holds the schema information for the "parameter_templates" table. ParameterTemplatesTable = &schema.Table{ Name: "parameter_templates", Columns: ParameterTemplatesColumns, PrimaryKey: []*schema.Column{ParameterTemplatesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "parameter_templates_profiles_parameter_templates", Columns: []*schema.Column{ParameterTemplatesColumns[10]}, RefColumns: []*schema.Column{ProfilesColumns[0]}, OnDelete: schema.Cascade, }, }, } // ProfilesColumns holds the columns for the "profiles" table. ProfilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "chart_values", Type: field.TypeString}, {Name: "application_profiles", Type: field.TypeUint64}, {Name: "parameter_template_profiles", Type: field.TypeUint64, Nullable: true}, } // ProfilesTable holds the schema information for the "profiles" table. ProfilesTable = &schema.Table{ Name: "profiles", Columns: ProfilesColumns, PrimaryKey: []*schema.Column{ProfilesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "profiles_applications_profiles", Columns: []*schema.Column{ProfilesColumns[8]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "profiles_parameter_templates_profiles", Columns: []*schema.Column{ProfilesColumns[9]}, RefColumns: []*schema.Column{ParameterTemplatesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "profile_name_application_profiles", Unique: true, Columns: []*schema.Column{ProfilesColumns[1], ProfilesColumns[8]}, }, }, } // RegistriesColumns holds the columns for the "registries" table. RegistriesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "name", Type: field.TypeString}, {Name: "display_name", Type: field.TypeString, Nullable: true}, {Name: "display_name_lc", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "create_time", Type: field.TypeTime}, {Name: "update_time", Type: field.TypeTime}, {Name: "project_uuid", Type: field.TypeString, Default: "default"}, {Name: "auth_token", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeString}, {Name: "api_type", Type: field.TypeString, Nullable: true}, } // RegistriesTable holds the schema information for the "registries" table. RegistriesTable = &schema.Table{ Name: "registries", Columns: RegistriesColumns, PrimaryKey: []*schema.Column{RegistriesColumns[0]}, Indexes: []*schema.Index{ { Name: "registry_project_uuid_name", Unique: true, Columns: []*schema.Column{RegistriesColumns[7], RegistriesColumns[1]}, }, }, } // DeploymentPackageApplicationsColumns holds the columns for the "deployment_package_applications" table. DeploymentPackageApplicationsColumns = []*schema.Column{ {Name: "deployment_package_id", Type: field.TypeInt}, {Name: "application_id", Type: field.TypeInt}, } // DeploymentPackageApplicationsTable holds the schema information for the "deployment_package_applications" table. DeploymentPackageApplicationsTable = &schema.Table{ Name: "deployment_package_applications", Columns: DeploymentPackageApplicationsColumns, PrimaryKey: []*schema.Column{DeploymentPackageApplicationsColumns[0], DeploymentPackageApplicationsColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_package_applications_deployment_package_id", Columns: []*schema.Column{DeploymentPackageApplicationsColumns[0]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "deployment_package_applications_application_id", Columns: []*schema.Column{DeploymentPackageApplicationsColumns[1]}, RefColumns: []*schema.Column{ApplicationsColumns[0]}, OnDelete: schema.Cascade, }, }, } // DeploymentPackageIconColumns holds the columns for the "deployment_package_icon" table. DeploymentPackageIconColumns = []*schema.Column{ {Name: "deployment_package_id", Type: field.TypeInt}, {Name: "artifact_id", Type: field.TypeInt}, } // DeploymentPackageIconTable holds the schema information for the "deployment_package_icon" table. DeploymentPackageIconTable = &schema.Table{ Name: "deployment_package_icon", Columns: DeploymentPackageIconColumns, PrimaryKey: []*schema.Column{DeploymentPackageIconColumns[0], DeploymentPackageIconColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_package_icon_deployment_package_id", Columns: []*schema.Column{DeploymentPackageIconColumns[0]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "deployment_package_icon_artifact_id", Columns: []*schema.Column{DeploymentPackageIconColumns[1]}, RefColumns: []*schema.Column{ArtifactsColumns[0]}, OnDelete: schema.Cascade, }, }, } // DeploymentPackageThumbnailColumns holds the columns for the "deployment_package_thumbnail" table. DeploymentPackageThumbnailColumns = []*schema.Column{ {Name: "deployment_package_id", Type: field.TypeInt}, {Name: "artifact_id", Type: field.TypeInt}, } // DeploymentPackageThumbnailTable holds the schema information for the "deployment_package_thumbnail" table. DeploymentPackageThumbnailTable = &schema.Table{ Name: "deployment_package_thumbnail", Columns: DeploymentPackageThumbnailColumns, PrimaryKey: []*schema.Column{DeploymentPackageThumbnailColumns[0], DeploymentPackageThumbnailColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_package_thumbnail_deployment_package_id", Columns: []*schema.Column{DeploymentPackageThumbnailColumns[0]}, RefColumns: []*schema.Column{DeploymentPackagesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "deployment_package_thumbnail_artifact_id", Columns: []*schema.Column{DeploymentPackageThumbnailColumns[1]}, RefColumns: []*schema.Column{ArtifactsColumns[0]}, OnDelete: schema.Cascade, }, }, } // DeploymentProfileProfilesColumns holds the columns for the "deployment_profile_profiles" table. DeploymentProfileProfilesColumns = []*schema.Column{ {Name: "deployment_profile_id", Type: field.TypeInt}, {Name: "profile_id", Type: field.TypeInt}, } // DeploymentProfileProfilesTable holds the schema information for the "deployment_profile_profiles" table. DeploymentProfileProfilesTable = &schema.Table{ Name: "deployment_profile_profiles", Columns: DeploymentProfileProfilesColumns, PrimaryKey: []*schema.Column{DeploymentProfileProfilesColumns[0], DeploymentProfileProfilesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployment_profile_profiles_deployment_profile_id", Columns: []*schema.Column{DeploymentProfileProfilesColumns[0]}, RefColumns: []*schema.Column{DeploymentProfilesColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "deployment_profile_profiles_profile_id", Columns: []*schema.Column{DeploymentProfileProfilesColumns[1]}, RefColumns: []*schema.Column{ProfilesColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ ApplicationsTable, ApplicationDependenciesTable, ApplicationNamespacesTable, ArtifactsTable, ArtifactReferencesTable, CommonMixinsTable, DeploymentPackagesTable, DeploymentProfilesTable, DeploymentRequirementsTable, EndpointsTable, ExtensionsTable, IgnoredResourcesTable, NamespacesTable, NamespaceAdornmentsTable, ParameterTemplatesTable, ProfilesTable, RegistriesTable, DeploymentPackageApplicationsTable, DeploymentPackageIconTable, DeploymentPackageThumbnailTable, DeploymentProfileProfilesTable, } )
Functions ¶
func Create ¶
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error
Create creates all table resources using the given schema driver.
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is the API for creating, migrating and dropping a schema.
func (*Schema) Diff ¶
Diff creates a migration file containing the statements to resolve the diff between the Ent schema and the connected database.
func (*Schema) NamedDiff ¶
NamedDiff creates a named migration file containing the statements to resolve the diff between the Ent schema and the connected database.
Click to show internal directories.
Click to hide internal directories.