migrate

package
v0.4.1-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

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 (
	// CatalogsColumns holds the columns for the "catalogs" table.
	CatalogsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "type", Type: field.TypeString},
		{Name: "source", Type: field.TypeString},
		{Name: "sync", Type: field.TypeJSON, Nullable: true},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// CatalogsTable holds the schema information for the "catalogs" table.
	CatalogsTable = &schema.Table{
		Name:       "catalogs",
		Columns:    CatalogsColumns,
		PrimaryKey: []*schema.Column{CatalogsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "catalogs_projects_catalogs",
				Columns:    []*schema.Column{CatalogsColumns[11]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "catalog_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{CatalogsColumns[11], CatalogsColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL",
				},
			},
			{
				Name:    "catalog_name",
				Unique:  true,
				Columns: []*schema.Column{CatalogsColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL",
				},
			},
		},
	}
	// ConnectorsColumns holds the columns for the "connectors" table.
	ConnectorsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "category", Type: field.TypeString},
		{Name: "type", Type: field.TypeString},
		{Name: "applicable_environment_type", Type: field.TypeString},
		{Name: "config_version", Type: field.TypeString},
		{Name: "config_data", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"mysql": "blob", "postgres": "bytea", "sqlite3": "blob"}},
		{Name: "enable_fin_ops", Type: field.TypeBool},
		{Name: "fin_ops_custom_pricing", Type: field.TypeJSON, Nullable: true},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ConnectorsTable holds the schema information for the "connectors" table.
	ConnectorsTable = &schema.Table{
		Name:       "connectors",
		Columns:    ConnectorsColumns,
		PrimaryKey: []*schema.Column{ConnectorsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "connectors_projects_connectors",
				Columns:    []*schema.Column{ConnectorsColumns[15]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "connector_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{ConnectorsColumns[15], ConnectorsColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL",
				},
			},
			{
				Name:    "connector_name",
				Unique:  true,
				Columns: []*schema.Column{ConnectorsColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL",
				},
			},
		},
	}
	// CostReportsColumns holds the columns for the "cost_reports" table.
	CostReportsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeInt, Increment: true},
		{Name: "start_time", Type: field.TypeTime},
		{Name: "end_time", Type: field.TypeTime},
		{Name: "minutes", Type: field.TypeFloat64},
		{Name: "name", Type: field.TypeString},
		{Name: "fingerprint", Type: field.TypeString},
		{Name: "cluster_name", Type: field.TypeString, Nullable: true},
		{Name: "namespace", Type: field.TypeString, Nullable: true},
		{Name: "node", Type: field.TypeString, Nullable: true},
		{Name: "controller", Type: field.TypeString, Nullable: true},
		{Name: "controller_kind", Type: field.TypeString, Nullable: true},
		{Name: "pod", Type: field.TypeString, Nullable: true},
		{Name: "container", Type: field.TypeString, Nullable: true},
		{Name: "pvs", Type: field.TypeJSON},
		{Name: "labels", Type: field.TypeJSON},
		{Name: "total_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "currency", Type: field.TypeInt, Nullable: true},
		{Name: "cpu_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "cpu_core_request", Type: field.TypeFloat64, Default: 0},
		{Name: "gpu_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "gpu_count", Type: field.TypeFloat64, Default: 0},
		{Name: "ram_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "ram_byte_request", Type: field.TypeFloat64, Default: 0},
		{Name: "pv_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "pv_bytes", Type: field.TypeFloat64, Default: 0},
		{Name: "load_balancer_cost", Type: field.TypeFloat64, Default: 0},
		{Name: "cpu_core_usage_average", Type: field.TypeFloat64, Default: 0},
		{Name: "cpu_core_usage_max", Type: field.TypeFloat64, Default: 0},
		{Name: "ram_byte_usage_average", Type: field.TypeFloat64, Default: 0},
		{Name: "ram_byte_usage_max", Type: field.TypeFloat64, Default: 0},
		{Name: "connector_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// CostReportsTable holds the schema information for the "cost_reports" table.
	CostReportsTable = &schema.Table{
		Name:       "cost_reports",
		Columns:    CostReportsColumns,
		PrimaryKey: []*schema.Column{CostReportsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "cost_reports_connectors_cost_reports",
				Columns:    []*schema.Column{CostReportsColumns[30]},
				RefColumns: []*schema.Column{ConnectorsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "costreport_start_time_end_time_connector_id_fingerprint",
				Unique:  true,
				Columns: []*schema.Column{CostReportsColumns[1], CostReportsColumns[2], CostReportsColumns[30], CostReportsColumns[5]},
			},
		},
	}
	// DistributeLocksColumns holds the columns for the "distribute_locks" table.
	DistributeLocksColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString},
		{Name: "expire_at", Type: field.TypeInt64},
		{Name: "holder", Type: field.TypeString},
	}
	// DistributeLocksTable holds the schema information for the "distribute_locks" table.
	DistributeLocksTable = &schema.Table{
		Name:       "distribute_locks",
		Columns:    DistributeLocksColumns,
		PrimaryKey: []*schema.Column{DistributeLocksColumns[0]},
	}
	// EnvironmentsColumns holds the columns for the "environments" table.
	EnvironmentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "type", Type: field.TypeString},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// EnvironmentsTable holds the schema information for the "environments" table.
	EnvironmentsTable = &schema.Table{
		Name:       "environments",
		Columns:    EnvironmentsColumns,
		PrimaryKey: []*schema.Column{EnvironmentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "environments_projects_environments",
				Columns:    []*schema.Column{EnvironmentsColumns[8]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "environment_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{EnvironmentsColumns[8], EnvironmentsColumns[1]},
			},
		},
	}
	// EnvironmentConnectorRelationshipsColumns holds the columns for the "environment_connector_relationships" table.
	EnvironmentConnectorRelationshipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "environment_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "connector_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// EnvironmentConnectorRelationshipsTable holds the schema information for the "environment_connector_relationships" table.
	EnvironmentConnectorRelationshipsTable = &schema.Table{
		Name:       "environment_connector_relationships",
		Columns:    EnvironmentConnectorRelationshipsColumns,
		PrimaryKey: []*schema.Column{EnvironmentConnectorRelationshipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "environment_connector_relationships_environments_environment",
				Columns:    []*schema.Column{EnvironmentConnectorRelationshipsColumns[2]},
				RefColumns: []*schema.Column{EnvironmentsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "environment_connector_relationships_connectors_connector",
				Columns:    []*schema.Column{EnvironmentConnectorRelationshipsColumns[3]},
				RefColumns: []*schema.Column{ConnectorsColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "environmentconnectorrelationship_create_time",
				Unique:  false,
				Columns: []*schema.Column{EnvironmentConnectorRelationshipsColumns[1]},
			},
			{
				Name:    "environmentconnectorrelationship_environment_id_connector_id",
				Unique:  true,
				Columns: []*schema.Column{EnvironmentConnectorRelationshipsColumns[2], EnvironmentConnectorRelationshipsColumns[3]},
			},
		},
	}
	// PerspectivesColumns holds the columns for the "perspectives" table.
	PerspectivesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "start_time", Type: field.TypeString},
		{Name: "end_time", Type: field.TypeString},
		{Name: "builtin", Type: field.TypeBool, Default: false},
		{Name: "cost_queries", Type: field.TypeJSON},
	}
	// PerspectivesTable holds the schema information for the "perspectives" table.
	PerspectivesTable = &schema.Table{
		Name:       "perspectives",
		Columns:    PerspectivesColumns,
		PrimaryKey: []*schema.Column{PerspectivesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "perspective_name",
				Unique:  true,
				Columns: []*schema.Column{PerspectivesColumns[1]},
			},
		},
	}
	// ProjectsColumns holds the columns for the "projects" table.
	ProjectsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
	}
	// ProjectsTable holds the schema information for the "projects" table.
	ProjectsTable = &schema.Table{
		Name:       "projects",
		Columns:    ProjectsColumns,
		PrimaryKey: []*schema.Column{ProjectsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "project_name",
				Unique:  true,
				Columns: []*schema.Column{ProjectsColumns[1]},
			},
		},
	}
	// ResourcesColumns holds the columns for the "resources" table.
	ResourcesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "type", Type: field.TypeString, Nullable: true},
		{Name: "attributes", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"mysql": "json", "postgres": "jsonb", "sqlite3": "text"}},
		{Name: "environment_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "resource_definition_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "template_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourcesTable holds the schema information for the "resources" table.
	ResourcesTable = &schema.Table{
		Name:       "resources",
		Columns:    ResourcesColumns,
		PrimaryKey: []*schema.Column{ResourcesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resources_environments_resources",
				Columns:    []*schema.Column{ResourcesColumns[10]},
				RefColumns: []*schema.Column{EnvironmentsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "resources_projects_resources",
				Columns:    []*schema.Column{ResourcesColumns[11]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "resources_resource_definitions_resources",
				Columns:    []*schema.Column{ResourcesColumns[12]},
				RefColumns: []*schema.Column{ResourceDefinitionsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "resources_template_versions_resources",
				Columns:    []*schema.Column{ResourcesColumns[13]},
				RefColumns: []*schema.Column{TemplateVersionsColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resource_project_id_environment_id_name",
				Unique:  true,
				Columns: []*schema.Column{ResourcesColumns[11], ResourcesColumns[10], ResourcesColumns[1]},
			},
		},
	}
	// ResourceComponentsColumns holds the columns for the "resource_components" table.
	ResourceComponentsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "mode", Type: field.TypeString},
		{Name: "type", Type: field.TypeString},
		{Name: "name", Type: field.TypeString},
		{Name: "deployer_type", Type: field.TypeString},
		{Name: "shape", Type: field.TypeString},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "connector_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "environment_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "resource_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "composition_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "class_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourceComponentsTable holds the schema information for the "resource_components" table.
	ResourceComponentsTable = &schema.Table{
		Name:       "resource_components",
		Columns:    ResourceComponentsColumns,
		PrimaryKey: []*schema.Column{ResourceComponentsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resource_components_connectors_resource_components",
				Columns:    []*schema.Column{ResourceComponentsColumns[9]},
				RefColumns: []*schema.Column{ConnectorsColumns[0]},
				OnDelete:   schema.Restrict,
			},
			{
				Symbol:     "resource_components_environments_resource_components",
				Columns:    []*schema.Column{ResourceComponentsColumns[10]},
				RefColumns: []*schema.Column{EnvironmentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "resource_components_projects_resource_components",
				Columns:    []*schema.Column{ResourceComponentsColumns[11]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "resource_components_resources_components",
				Columns:    []*schema.Column{ResourceComponentsColumns[12]},
				RefColumns: []*schema.Column{ResourcesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "resource_components_resource_components_components",
				Columns:    []*schema.Column{ResourceComponentsColumns[13]},
				RefColumns: []*schema.Column{ResourceComponentsColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "resource_components_resource_components_instances",
				Columns:    []*schema.Column{ResourceComponentsColumns[14]},
				RefColumns: []*schema.Column{ResourceComponentsColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resourcecomponent_create_time",
				Unique:  false,
				Columns: []*schema.Column{ResourceComponentsColumns[1]},
			},
		},
	}
	// ResourceComponentRelationshipsColumns holds the columns for the "resource_component_relationships" table.
	ResourceComponentRelationshipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "type", Type: field.TypeString},
		{Name: "resource_component_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "dependency_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourceComponentRelationshipsTable holds the schema information for the "resource_component_relationships" table.
	ResourceComponentRelationshipsTable = &schema.Table{
		Name:       "resource_component_relationships",
		Columns:    ResourceComponentRelationshipsColumns,
		PrimaryKey: []*schema.Column{ResourceComponentRelationshipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resource_component_relationships_resource_components_resource_component",
				Columns:    []*schema.Column{ResourceComponentRelationshipsColumns[3]},
				RefColumns: []*schema.Column{ResourceComponentsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "resource_component_relationships_resource_components_dependency",
				Columns:    []*schema.Column{ResourceComponentRelationshipsColumns[4]},
				RefColumns: []*schema.Column{ResourceComponentsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resourcecomponentrelationship_create_time",
				Unique:  false,
				Columns: []*schema.Column{ResourceComponentRelationshipsColumns[1]},
			},
			{
				Name:    "resourcecomponentrelationship_resource_component_id_dependency_id_type",
				Unique:  true,
				Columns: []*schema.Column{ResourceComponentRelationshipsColumns[3], ResourceComponentRelationshipsColumns[4], ResourceComponentRelationshipsColumns[2]},
			},
		},
	}
	// ResourceDefinitionsColumns holds the columns for the "resource_definitions" table.
	ResourceDefinitionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "type", Type: field.TypeString},
		{Name: "schema", Type: field.TypeJSON},
		{Name: "ui_schema", Type: field.TypeJSON, Nullable: true},
	}
	// ResourceDefinitionsTable holds the schema information for the "resource_definitions" table.
	ResourceDefinitionsTable = &schema.Table{
		Name:       "resource_definitions",
		Columns:    ResourceDefinitionsColumns,
		PrimaryKey: []*schema.Column{ResourceDefinitionsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "resourcedefinition_type",
				Unique:  true,
				Columns: []*schema.Column{ResourceDefinitionsColumns[7]},
			},
			{
				Name:    "resourcedefinition_name",
				Unique:  true,
				Columns: []*schema.Column{ResourceDefinitionsColumns[1]},
			},
		},
	}
	// ResourceDefinitionMatchingRulesColumns holds the columns for the "resource_definition_matching_rules" table.
	ResourceDefinitionMatchingRulesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "selector", Type: field.TypeJSON},
		{Name: "attributes", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"mysql": "json", "postgres": "jsonb", "sqlite3": "text"}},
		{Name: "order", Type: field.TypeInt},
		{Name: "resource_definition_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "template_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourceDefinitionMatchingRulesTable holds the schema information for the "resource_definition_matching_rules" table.
	ResourceDefinitionMatchingRulesTable = &schema.Table{
		Name:       "resource_definition_matching_rules",
		Columns:    ResourceDefinitionMatchingRulesColumns,
		PrimaryKey: []*schema.Column{ResourceDefinitionMatchingRulesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resource_definition_matching_rules_resource_definitions_resource_definition",
				Columns:    []*schema.Column{ResourceDefinitionMatchingRulesColumns[6]},
				RefColumns: []*schema.Column{ResourceDefinitionsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "resource_definition_matching_rules_template_versions_template",
				Columns:    []*schema.Column{ResourceDefinitionMatchingRulesColumns[7]},
				RefColumns: []*schema.Column{TemplateVersionsColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resourcedefinitionmatchingrule_create_time",
				Unique:  false,
				Columns: []*schema.Column{ResourceDefinitionMatchingRulesColumns[1]},
			},
			{
				Name:    "resourcedefinitionmatchingrule_resource_definition_id_name",
				Unique:  true,
				Columns: []*schema.Column{ResourceDefinitionMatchingRulesColumns[6], ResourceDefinitionMatchingRulesColumns[2]},
			},
			{
				Name:    "resourcedefinitionmatchingrule_resource_definition_id_template_id_name",
				Unique:  true,
				Columns: []*schema.Column{ResourceDefinitionMatchingRulesColumns[6], ResourceDefinitionMatchingRulesColumns[7], ResourceDefinitionMatchingRulesColumns[2]},
			},
		},
	}
	// ResourceRelationshipsColumns holds the columns for the "resource_relationships" table.
	ResourceRelationshipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "path", Type: field.TypeJSON},
		{Name: "type", Type: field.TypeString},
		{Name: "resource_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "dependency_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourceRelationshipsTable holds the schema information for the "resource_relationships" table.
	ResourceRelationshipsTable = &schema.Table{
		Name:       "resource_relationships",
		Columns:    ResourceRelationshipsColumns,
		PrimaryKey: []*schema.Column{ResourceRelationshipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resource_relationships_resources_resource",
				Columns:    []*schema.Column{ResourceRelationshipsColumns[4]},
				RefColumns: []*schema.Column{ResourcesColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "resource_relationships_resources_dependency",
				Columns:    []*schema.Column{ResourceRelationshipsColumns[5]},
				RefColumns: []*schema.Column{ResourcesColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resourcerelationship_create_time",
				Unique:  false,
				Columns: []*schema.Column{ResourceRelationshipsColumns[1]},
			},
			{
				Name:    "resourcerelationship_resource_id_dependency_id_path",
				Unique:  true,
				Columns: []*schema.Column{ResourceRelationshipsColumns[4], ResourceRelationshipsColumns[5], ResourceRelationshipsColumns[2]},
			},
		},
	}
	// ResourceRevisionsColumns holds the columns for the "resource_revisions" table.
	ResourceRevisionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "template_name", Type: field.TypeString},
		{Name: "template_version", Type: field.TypeString},
		{Name: "template_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "attributes", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"mysql": "json", "postgres": "jsonb", "sqlite3": "text"}},
		{Name: "variables", Type: field.TypeOther, SchemaType: map[string]string{"mysql": "blob", "postgres": "bytea", "sqlite3": "blob"}},
		{Name: "input_plan", Type: field.TypeString},
		{Name: "output", Type: field.TypeString},
		{Name: "deployer_type", Type: field.TypeString, Default: "Terraform"},
		{Name: "duration", Type: field.TypeInt, Default: 0},
		{Name: "previous_required_providers", Type: field.TypeJSON},
		{Name: "record", Type: field.TypeString, Nullable: true, Size: 2147483647},
		{Name: "environment_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "resource_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// ResourceRevisionsTable holds the schema information for the "resource_revisions" table.
	ResourceRevisionsTable = &schema.Table{
		Name:       "resource_revisions",
		Columns:    ResourceRevisionsColumns,
		PrimaryKey: []*schema.Column{ResourceRevisionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "resource_revisions_environments_resource_revisions",
				Columns:    []*schema.Column{ResourceRevisionsColumns[14]},
				RefColumns: []*schema.Column{EnvironmentsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "resource_revisions_projects_resource_revisions",
				Columns:    []*schema.Column{ResourceRevisionsColumns[15]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "resource_revisions_resources_revisions",
				Columns:    []*schema.Column{ResourceRevisionsColumns[16]},
				RefColumns: []*schema.Column{ResourcesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "resourcerevision_create_time",
				Unique:  false,
				Columns: []*schema.Column{ResourceRevisionsColumns[1]},
			},
		},
	}
	// RolesColumns holds the columns for the "roles" table.
	RolesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, Unique: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "kind", Type: field.TypeString, Default: "system"},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "policies", Type: field.TypeJSON},
		{Name: "applicable_environment_types", Type: field.TypeJSON, Nullable: true},
		{Name: "session", Type: field.TypeBool, Default: false},
		{Name: "builtin", Type: field.TypeBool, Default: false},
	}
	// RolesTable holds the schema information for the "roles" table.
	RolesTable = &schema.Table{
		Name:       "roles",
		Columns:    RolesColumns,
		PrimaryKey: []*schema.Column{RolesColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "role_create_time",
				Unique:  false,
				Columns: []*schema.Column{RolesColumns[1]},
			},
		},
	}
	// SettingsColumns holds the columns for the "settings" table.
	SettingsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "value", Type: field.TypeString, SchemaType: map[string]string{"mysql": "blob", "postgres": "bytea", "sqlite3": "blob"}},
		{Name: "hidden", Type: field.TypeBool, Nullable: true, Default: false},
		{Name: "editable", Type: field.TypeBool, Nullable: true, Default: false},
		{Name: "sensitive", Type: field.TypeBool, Nullable: true, Default: false},
		{Name: "private", Type: field.TypeBool, Nullable: true, Default: false},
	}
	// SettingsTable holds the schema information for the "settings" table.
	SettingsTable = &schema.Table{
		Name:       "settings",
		Columns:    SettingsColumns,
		PrimaryKey: []*schema.Column{SettingsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "setting_create_time",
				Unique:  false,
				Columns: []*schema.Column{SettingsColumns[1]},
			},
			{
				Name:    "setting_name",
				Unique:  true,
				Columns: []*schema.Column{SettingsColumns[3]},
			},
		},
	}
	// SubjectsColumns holds the columns for the "subjects" table.
	SubjectsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "kind", Type: field.TypeString, Default: "user"},
		{Name: "domain", Type: field.TypeString, Default: "builtin"},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "builtin", Type: field.TypeBool, Default: false},
	}
	// SubjectsTable holds the schema information for the "subjects" table.
	SubjectsTable = &schema.Table{
		Name:       "subjects",
		Columns:    SubjectsColumns,
		PrimaryKey: []*schema.Column{SubjectsColumns[0]},
		Indexes: []*schema.Index{
			{
				Name:    "subject_create_time",
				Unique:  false,
				Columns: []*schema.Column{SubjectsColumns[1]},
			},
			{
				Name:    "subject_kind_domain_name",
				Unique:  true,
				Columns: []*schema.Column{SubjectsColumns[3], SubjectsColumns[4], SubjectsColumns[5]},
			},
		},
	}
	// SubjectRoleRelationshipsColumns holds the columns for the "subject_role_relationships" table.
	SubjectRoleRelationshipsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "subject_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "role_id", Type: field.TypeString},
	}
	// SubjectRoleRelationshipsTable holds the schema information for the "subject_role_relationships" table.
	SubjectRoleRelationshipsTable = &schema.Table{
		Name:       "subject_role_relationships",
		Columns:    SubjectRoleRelationshipsColumns,
		PrimaryKey: []*schema.Column{SubjectRoleRelationshipsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "subject_role_relationships_projects_subject_roles",
				Columns:    []*schema.Column{SubjectRoleRelationshipsColumns[2]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "subject_role_relationships_subjects_subject",
				Columns:    []*schema.Column{SubjectRoleRelationshipsColumns[3]},
				RefColumns: []*schema.Column{SubjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "subject_role_relationships_roles_role",
				Columns:    []*schema.Column{SubjectRoleRelationshipsColumns[4]},
				RefColumns: []*schema.Column{RolesColumns[0]},
				OnDelete:   schema.Restrict,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "subjectrolerelationship_create_time",
				Unique:  false,
				Columns: []*schema.Column{SubjectRoleRelationshipsColumns[1]},
			},
			{
				Name:    "subjectrolerelationship_project_id_subject_id_role_id",
				Unique:  true,
				Columns: []*schema.Column{SubjectRoleRelationshipsColumns[2], SubjectRoleRelationshipsColumns[3], SubjectRoleRelationshipsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL",
				},
			},
			{
				Name:    "subjectrolerelationship_subject_id_role_id",
				Unique:  true,
				Columns: []*schema.Column{SubjectRoleRelationshipsColumns[3], SubjectRoleRelationshipsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL",
				},
			},
		},
	}
	// TemplatesColumns holds the columns for the "templates" table.
	TemplatesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "icon", Type: field.TypeString, Nullable: true},
		{Name: "source", Type: field.TypeString},
		{Name: "catalog_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// TemplatesTable holds the schema information for the "templates" table.
	TemplatesTable = &schema.Table{
		Name:       "templates",
		Columns:    TemplatesColumns,
		PrimaryKey: []*schema.Column{TemplatesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "templates_catalogs_templates",
				Columns:    []*schema.Column{TemplatesColumns[9]},
				RefColumns: []*schema.Column{CatalogsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "templates_projects_templates",
				Columns:    []*schema.Column{TemplatesColumns[10]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "template_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{TemplatesColumns[10], TemplatesColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL",
				},
			},
			{
				Name:    "template_name",
				Unique:  true,
				Columns: []*schema.Column{TemplatesColumns[1]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL",
				},
			},
		},
	}
	// TemplateVersionsColumns holds the columns for the "template_versions" table.
	TemplateVersionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "version", Type: field.TypeString},
		{Name: "source", Type: field.TypeString},
		{Name: "schema", Type: field.TypeJSON},
		{Name: "ui_schema", Type: field.TypeJSON},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "template_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// TemplateVersionsTable holds the schema information for the "template_versions" table.
	TemplateVersionsTable = &schema.Table{
		Name:       "template_versions",
		Columns:    TemplateVersionsColumns,
		PrimaryKey: []*schema.Column{TemplateVersionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "template_versions_projects_template_versions",
				Columns:    []*schema.Column{TemplateVersionsColumns[8]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "template_versions_templates_versions",
				Columns:    []*schema.Column{TemplateVersionsColumns[9]},
				RefColumns: []*schema.Column{TemplatesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "templateversion_create_time",
				Unique:  false,
				Columns: []*schema.Column{TemplateVersionsColumns[1]},
			},
			{
				Name:    "templateversion_name_version_project_id",
				Unique:  true,
				Columns: []*schema.Column{TemplateVersionsColumns[3], TemplateVersionsColumns[4], TemplateVersionsColumns[8]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL",
				},
			},
			{
				Name:    "templateversion_name_version",
				Unique:  true,
				Columns: []*schema.Column{TemplateVersionsColumns[3], TemplateVersionsColumns[4]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL",
				},
			},
		},
	}
	// TokensColumns holds the columns for the "tokens" table.
	TokensColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "kind", Type: field.TypeString, Default: "api"},
		{Name: "name", Type: field.TypeString, Unique: true},
		{Name: "expiration", Type: field.TypeTime, Nullable: true},
		{Name: "value", Type: field.TypeString, SchemaType: map[string]string{"mysql": "blob", "postgres": "bytea", "sqlite3": "blob"}},
		{Name: "subject_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// TokensTable holds the schema information for the "tokens" table.
	TokensTable = &schema.Table{
		Name:       "tokens",
		Columns:    TokensColumns,
		PrimaryKey: []*schema.Column{TokensColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "tokens_subjects_tokens",
				Columns:    []*schema.Column{TokensColumns[6]},
				RefColumns: []*schema.Column{SubjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "token_create_time",
				Unique:  false,
				Columns: []*schema.Column{TokensColumns[1]},
			},
		},
	}
	// VariablesColumns holds the columns for the "variables" table.
	VariablesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "name", Type: field.TypeString},
		{Name: "value", Type: field.TypeString, SchemaType: map[string]string{"mysql": "blob", "postgres": "bytea", "sqlite3": "blob"}},
		{Name: "sensitive", Type: field.TypeBool, Default: false},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "environment_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "project_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// VariablesTable holds the schema information for the "variables" table.
	VariablesTable = &schema.Table{
		Name:       "variables",
		Columns:    VariablesColumns,
		PrimaryKey: []*schema.Column{VariablesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "variables_environments_variables",
				Columns:    []*schema.Column{VariablesColumns[7]},
				RefColumns: []*schema.Column{EnvironmentsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "variables_projects_variables",
				Columns:    []*schema.Column{VariablesColumns[8]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "variable_create_time",
				Unique:  false,
				Columns: []*schema.Column{VariablesColumns[1]},
			},
			{
				Name:    "variable_project_id_environment_id_name",
				Unique:  true,
				Columns: []*schema.Column{VariablesColumns[8], VariablesColumns[7], VariablesColumns[3]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL and environment_id IS NOT NULL",
				},
			},
			{
				Name:    "variable_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{VariablesColumns[8], VariablesColumns[3]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NOT NULL AND environment_id IS NULL",
				},
			},
			{
				Name:    "variable_name",
				Unique:  true,
				Columns: []*schema.Column{VariablesColumns[3]},
				Annotation: &entsql.IndexAnnotation{
					Where: "project_id IS NULL AND environment_id IS NULL",
				},
			},
		},
	}
	// WorkflowsColumns holds the columns for the "workflows" table.
	WorkflowsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "environment_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "type", Type: field.TypeString},
		{Name: "parallelism", Type: field.TypeInt, Default: 10},
		{Name: "timeout", Type: field.TypeInt, Default: 0},
		{Name: "version", Type: field.TypeInt, Default: 0},
		{Name: "variables", Type: field.TypeJSON, Nullable: true},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowsTable holds the schema information for the "workflows" table.
	WorkflowsTable = &schema.Table{
		Name:       "workflows",
		Columns:    WorkflowsColumns,
		PrimaryKey: []*schema.Column{WorkflowsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflows_projects_workflows",
				Columns:    []*schema.Column{WorkflowsColumns[13]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
		Indexes: []*schema.Index{
			{
				Name:    "workflow_project_id_name",
				Unique:  true,
				Columns: []*schema.Column{WorkflowsColumns[13], WorkflowsColumns[1]},
			},
		},
	}
	// WorkflowExecutionsColumns holds the columns for the "workflow_executions" table.
	WorkflowExecutionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "version", Type: field.TypeInt},
		{Name: "type", Type: field.TypeString},
		{Name: "subject_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "execute_time", Type: field.TypeTime, Nullable: true},
		{Name: "times", Type: field.TypeInt, Default: 1},
		{Name: "duration", Type: field.TypeInt, Default: 0},
		{Name: "parallelism", Type: field.TypeInt, Default: 10},
		{Name: "timeout", Type: field.TypeInt, Default: 0},
		{Name: "trigger", Type: field.TypeJSON},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowExecutionsTable holds the schema information for the "workflow_executions" table.
	WorkflowExecutionsTable = &schema.Table{
		Name:       "workflow_executions",
		Columns:    WorkflowExecutionsColumns,
		PrimaryKey: []*schema.Column{WorkflowExecutionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_executions_projects_workflow_executions",
				Columns:    []*schema.Column{WorkflowExecutionsColumns[17]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_executions_workflows_executions",
				Columns:    []*schema.Column{WorkflowExecutionsColumns[18]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WorkflowStagesColumns holds the columns for the "workflow_stages" table.
	WorkflowStagesColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "dependencies", Type: field.TypeJSON},
		{Name: "order", Type: field.TypeInt, Default: 0},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowStagesTable holds the schema information for the "workflow_stages" table.
	WorkflowStagesTable = &schema.Table{
		Name:       "workflow_stages",
		Columns:    WorkflowStagesColumns,
		PrimaryKey: []*schema.Column{WorkflowStagesColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_stages_projects_workflow_stages",
				Columns:    []*schema.Column{WorkflowStagesColumns[9]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_stages_workflows_stages",
				Columns:    []*schema.Column{WorkflowStagesColumns[10]},
				RefColumns: []*schema.Column{WorkflowsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WorkflowStageExecutionsColumns holds the columns for the "workflow_stage_executions" table.
	WorkflowStageExecutionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "workflow_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_stage_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "execute_time", Type: field.TypeTime, Nullable: true},
		{Name: "duration", Type: field.TypeInt, Default: 0},
		{Name: "order", Type: field.TypeInt, Default: 0},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_execution_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowStageExecutionsTable holds the schema information for the "workflow_stage_executions" table.
	WorkflowStageExecutionsTable = &schema.Table{
		Name:       "workflow_stage_executions",
		Columns:    WorkflowStageExecutionsColumns,
		PrimaryKey: []*schema.Column{WorkflowStageExecutionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_stage_executions_projects_workflow_stage_executions",
				Columns:    []*schema.Column{WorkflowStageExecutionsColumns[13]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_stage_executions_workflow_executions_stages",
				Columns:    []*schema.Column{WorkflowStageExecutionsColumns[14]},
				RefColumns: []*schema.Column{WorkflowExecutionsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WorkflowStepsColumns holds the columns for the "workflow_steps" table.
	WorkflowStepsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "type", Type: field.TypeString},
		{Name: "workflow_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "attributes", Type: field.TypeJSON, Nullable: true},
		{Name: "inputs", Type: field.TypeJSON, Nullable: true},
		{Name: "outputs", Type: field.TypeJSON, Nullable: true},
		{Name: "order", Type: field.TypeInt, Default: 0},
		{Name: "dependencies", Type: field.TypeJSON},
		{Name: "retry_strategy", Type: field.TypeJSON, Nullable: true},
		{Name: "timeout", Type: field.TypeInt, Default: 0},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_stage_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowStepsTable holds the schema information for the "workflow_steps" table.
	WorkflowStepsTable = &schema.Table{
		Name:       "workflow_steps",
		Columns:    WorkflowStepsColumns,
		PrimaryKey: []*schema.Column{WorkflowStepsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_steps_projects_workflow_steps",
				Columns:    []*schema.Column{WorkflowStepsColumns[16]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_steps_workflow_stages_steps",
				Columns:    []*schema.Column{WorkflowStepsColumns[17]},
				RefColumns: []*schema.Column{WorkflowStagesColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// WorkflowStepExecutionsColumns holds the columns for the "workflow_step_executions" table.
	WorkflowStepExecutionsColumns = []*schema.Column{
		{Name: "id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "name", Type: field.TypeString},
		{Name: "description", Type: field.TypeString, Nullable: true},
		{Name: "labels", Type: field.TypeJSON, Nullable: true},
		{Name: "annotations", Type: field.TypeJSON, Nullable: true},
		{Name: "create_time", Type: field.TypeTime},
		{Name: "update_time", Type: field.TypeTime},
		{Name: "status", Type: field.TypeJSON, Nullable: true},
		{Name: "workflow_step_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_execution_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "type", Type: field.TypeString},
		{Name: "attributes", Type: field.TypeJSON, Nullable: true},
		{Name: "times", Type: field.TypeInt, Default: 1},
		{Name: "execute_time", Type: field.TypeTime, Nullable: true},
		{Name: "duration", Type: field.TypeInt, Default: 0},
		{Name: "retry_strategy", Type: field.TypeJSON, Nullable: true},
		{Name: "timeout", Type: field.TypeInt, Default: 0},
		{Name: "order", Type: field.TypeInt, Default: 0},
		{Name: "record", Type: field.TypeString, Size: 2147483647, Default: ""},
		{Name: "project_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
		{Name: "workflow_stage_execution_id", Type: field.TypeString, SchemaType: map[string]string{"mysql": "bigint", "postgres": "bigint", "sqlite3": "integer"}},
	}
	// WorkflowStepExecutionsTable holds the schema information for the "workflow_step_executions" table.
	WorkflowStepExecutionsTable = &schema.Table{
		Name:       "workflow_step_executions",
		Columns:    WorkflowStepExecutionsColumns,
		PrimaryKey: []*schema.Column{WorkflowStepExecutionsColumns[0]},
		ForeignKeys: []*schema.ForeignKey{
			{
				Symbol:     "workflow_step_executions_projects_workflow_step_executions",
				Columns:    []*schema.Column{WorkflowStepExecutionsColumns[20]},
				RefColumns: []*schema.Column{ProjectsColumns[0]},
				OnDelete:   schema.Cascade,
			},
			{
				Symbol:     "workflow_step_executions_workflow_stage_executions_steps",
				Columns:    []*schema.Column{WorkflowStepExecutionsColumns[21]},
				RefColumns: []*schema.Column{WorkflowStageExecutionsColumns[0]},
				OnDelete:   schema.Cascade,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		CatalogsTable,
		ConnectorsTable,
		CostReportsTable,
		DistributeLocksTable,
		EnvironmentsTable,
		EnvironmentConnectorRelationshipsTable,
		PerspectivesTable,
		ProjectsTable,
		ResourcesTable,
		ResourceComponentsTable,
		ResourceComponentRelationshipsTable,
		ResourceDefinitionsTable,
		ResourceDefinitionMatchingRulesTable,
		ResourceRelationshipsTable,
		ResourceRevisionsTable,
		RolesTable,
		SettingsTable,
		SubjectsTable,
		SubjectRoleRelationshipsTable,
		TemplatesTable,
		TemplateVersionsTable,
		TokensTable,
		VariablesTable,
		WorkflowsTable,
		WorkflowExecutionsTable,
		WorkflowStagesTable,
		WorkflowStageExecutionsTable,
		WorkflowStepsTable,
		WorkflowStepExecutionsTable,
	}
)

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.

func Diff

func Diff(ctx context.Context, url string, opts ...schema.MigrateOption) error

Diff compares the state read from a database connection or migration directory with the state defined by the Ent schema. Changes will be written to new migration files.

func NamedDiff

func NamedDiff(ctx context.Context, url, name string, opts ...schema.MigrateOption) error

NamedDiff compares the state read from a database connection or migration directory with the state defined by the Ent schema. Changes will be written to new named migration files.

Types

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is the API for creating, migrating and dropping a schema.

func NewSchema

func NewSchema(drv dialect.Driver) *Schema

NewSchema creates a new schema client.

func (*Schema) Create

func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error

Create creates all schema resources.

func (*Schema) Diff

func (s *Schema) Diff(ctx context.Context, opts ...schema.MigrateOption) error

Diff creates a migration file containing the statements to resolve the diff between the Ent schema and the connected database.

func (*Schema) NamedDiff

func (s *Schema) NamedDiff(ctx context.Context, name string, opts ...schema.MigrateOption) error

NamedDiff creates a named migration file containing the statements to resolve the diff between the Ent schema and the connected database.

func (*Schema) WriteTo

func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error

WriteTo writes the schema changes to w instead of running them against the database.

if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
	log.Fatal(err)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL