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 ( // DatasetsColumns holds the columns for the "datasets" table. DatasetsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "nanoid", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "path", Type: field.TypeString, Nullable: true}, {Name: "description", Type: field.TypeString, Default: ""}, {Name: "type", Type: field.TypeEnum, Enums: []string{"list", "csv", "image"}}, {Name: "indexer", Type: field.TypeJSON, Nullable: true}, {Name: "values", Type: field.TypeJSON, Nullable: true}, } // DatasetsTable holds the schema information for the "datasets" table. DatasetsTable = &schema.Table{ Name: "datasets", Columns: DatasetsColumns, PrimaryKey: []*schema.Column{DatasetsColumns[0]}, } // ModelsColumns holds the columns for the "models" table. ModelsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "model", Type: field.TypeString, Unique: true}, {Name: "alias", Type: field.TypeString, Nullable: true}, {Name: "rpm", Type: field.TypeInt, Nullable: true}, {Name: "max_tokens", Type: field.TypeInt, Nullable: true}, {Name: "default", Type: field.TypeBool, Default: false}, {Name: "image", Type: field.TypeBool, Default: false}, {Name: "provider_models", Type: field.TypeInt, Nullable: true}, } // ModelsTable holds the schema information for the "models" table. ModelsTable = &schema.Table{ Name: "models", Columns: ModelsColumns, PrimaryKey: []*schema.Column{ModelsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "models_providers_models", Columns: []*schema.Column{ModelsColumns[9]}, RefColumns: []*schema.Column{ProvidersColumns[0]}, OnDelete: schema.Cascade, }, }, } // ProvidersColumns holds the columns for the "providers" table. ProvidersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "type", Type: field.TypeString}, {Name: "key", Type: field.TypeString, Nullable: true}, {Name: "base_url", Type: field.TypeString, Nullable: true}, {Name: "enabled", Type: field.TypeBool, Default: true}, } // ProvidersTable holds the schema information for the "providers" table. ProvidersTable = &schema.Table{ Name: "providers", Columns: ProvidersColumns, PrimaryKey: []*schema.Column{ProvidersColumns[0]}, } // TableColumnsColumns holds the columns for the "table_columns" table. TableColumnsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "nanoid", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "type", Type: field.TypeEnum, Enums: []string{"string", "number", "integer", "boolean", "array", "image"}}, {Name: "fill_mode", Type: field.TypeEnum, Enums: []string{"ai", "pick"}}, {Name: "source", Type: field.TypeString, Nullable: true}, {Name: "source_id", Type: field.TypeString, Nullable: true}, {Name: "source_type", Type: field.TypeEnum, Nullable: true, Enums: []string{"table", "dataset", "options"}}, {Name: "context_length", Type: field.TypeInt, Default: 0}, {Name: "random", Type: field.TypeBool, Default: false}, {Name: "replacement", Type: field.TypeBool, Default: false}, {Name: "repeat", Type: field.TypeInt, Default: 1}, {Name: "linked_column", Type: field.TypeString, Default: ""}, {Name: "linked_context_columns", Type: field.TypeJSON}, {Name: "options", Type: field.TypeJSON, Nullable: true}, {Name: "table_id", Type: field.TypeInt}, } // TableColumnsTable holds the schema information for the "table_columns" table. TableColumnsTable = &schema.Table{ Name: "table_columns", Columns: TableColumnsColumns, PrimaryKey: []*schema.Column{TableColumnsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "table_columns_table_meta_columns", Columns: []*schema.Column{TableColumnsColumns[18]}, RefColumns: []*schema.Column{TableMetaColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "tablecolumn_name_table_id", Unique: true, Columns: []*schema.Column{TableColumnsColumns[4], TableColumnsColumns[18]}, }, }, } // TableMetaColumns holds the columns for the "table_meta" table. TableMetaColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "nanoid", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "description", Type: field.TypeString, Default: ""}, {Name: "model", Type: field.TypeString, Default: ""}, } // TableMetaTable holds the schema information for the "table_meta" table. TableMetaTable = &schema.Table{ Name: "table_meta", Columns: TableMetaColumns, PrimaryKey: []*schema.Column{TableMetaColumns[0]}, } // TableRowsColumns holds the columns for the "table_rows" table. TableRowsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "nanoid", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "cells", Type: field.TypeJSON, Nullable: true}, {Name: "table_meta_rows", Type: field.TypeInt}, } // TableRowsTable holds the schema information for the "table_rows" table. TableRowsTable = &schema.Table{ Name: "table_rows", Columns: TableRowsColumns, PrimaryKey: []*schema.Column{TableRowsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "table_rows_table_meta_rows", Columns: []*schema.Column{TableRowsColumns[5]}, RefColumns: []*schema.Column{TableMetaColumns[0]}, OnDelete: schema.Cascade, }, }, } // WorkflowsColumns holds the columns for the "workflows" table. WorkflowsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "nanoid", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "name", Type: field.TypeString, Unique: true}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "variables", Type: field.TypeJSON}, {Name: "steps", Type: field.TypeJSON}, } // WorkflowsTable holds the schema information for the "workflows" table. WorkflowsTable = &schema.Table{ Name: "workflows", Columns: WorkflowsColumns, PrimaryKey: []*schema.Column{WorkflowsColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ DatasetsTable, ModelsTable, ProvidersTable, TableColumnsTable, TableMetaTable, TableRowsTable, WorkflowsTable, } )
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.