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 // WithFixture sets the foreign-key renaming option to the migration when upgrading // ent from v0.1.0 (issue-#285). Defaults to false. WithFixture = schema.WithFixture // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys )
View Source
var ( // CredentialsColumns holds the columns for the "credentials" table. CredentialsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "registry", Type: field.TypeString}, {Name: "username", Type: field.TypeString}, {Name: "password", Type: field.TypeString}, {Name: "deployment_credentials", Type: field.TypeUUID, Nullable: true}, {Name: "process_credentials", Type: field.TypeString, Nullable: true}, } // CredentialsTable holds the schema information for the "credentials" table. CredentialsTable = &schema.Table{ Name: "credentials", Columns: CredentialsColumns, PrimaryKey: []*schema.Column{CredentialsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "credentials_deployments_credentials", Columns: []*schema.Column{CredentialsColumns[6]}, RefColumns: []*schema.Column{DeploymentsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "credentials_processes_credentials", Columns: []*schema.Column{CredentialsColumns[7]}, RefColumns: []*schema.Column{ProcessesColumns[0]}, OnDelete: schema.SetNull, }, }, } // DeploymentsColumns holds the columns for the "deployments" table. DeploymentsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "state", Type: field.TypeEnum, Enums: []string{"pending", "provisioning", "running", "failed", "succeeded"}, Default: "pending"}, {Name: "name", Type: field.TypeString, Nullable: true, Default: "unknown"}, {Name: "timeout", Type: field.TypeInt}, {Name: "deployment_provider", Type: field.TypeUUID, Nullable: true}, } // DeploymentsTable holds the schema information for the "deployments" table. DeploymentsTable = &schema.Table{ Name: "deployments", Columns: DeploymentsColumns, PrimaryKey: []*schema.Column{DeploymentsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "deployments_providers_provider", Columns: []*schema.Column{DeploymentsColumns[6]}, RefColumns: []*schema.Column{ProvidersColumns[0]}, OnDelete: schema.SetNull, }, }, } // ProcessesColumns holds the columns for the "processes" table. ProcessesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "token", Type: field.TypeString}, {Name: "instance_type", Type: field.TypeString}, {Name: "ami_id", Type: field.TypeString}, {Name: "resource_prefix", Type: field.TypeString}, {Name: "timeout", Type: field.TypeInt, Nullable: true}, {Name: "expiration", Type: field.TypeInt}, {Name: "state", Type: field.TypeEnum, Enums: []string{"PENDING", "PROVISIONING", "DEPLOYING", "RUNNING", "IDLE", "STOPPING", "EXIT_TIMEOUT", "EXIT_SUCCESS"}, Default: "PENDING"}, {Name: "process_stack", Type: field.TypeString, Nullable: true}, } // ProcessesTable holds the schema information for the "processes" table. ProcessesTable = &schema.Table{ Name: "processes", Columns: ProcessesColumns, PrimaryKey: []*schema.Column{ProcessesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "processes_stacks_stack", Columns: []*schema.Column{ProcessesColumns[11]}, RefColumns: []*schema.Column{StacksColumns[0]}, OnDelete: schema.SetNull, }, }, } // ProvidersColumns holds the columns for the "providers" table. ProvidersColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "hostname", Type: field.TypeString}, {Name: "token", Type: field.TypeString}, } // ProvidersTable holds the schema information for the "providers" table. ProvidersTable = &schema.Table{ Name: "providers", Columns: ProvidersColumns, PrimaryKey: []*schema.Column{ProvidersColumns[0]}, } // StacksColumns holds the columns for the "stacks" table. StacksColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "instance", Type: field.TypeString}, {Name: "vpc_id", Type: field.TypeString}, {Name: "public_ip", Type: field.TypeString}, {Name: "public_dns", Type: field.TypeString, Nullable: true}, {Name: "username", Type: field.TypeString}, {Name: "security_group", Type: field.TypeString}, {Name: "key_pair", Type: field.TypeString}, {Name: "name", Type: field.TypeString}, {Name: "private_key", Type: field.TypeString}, {Name: "filepath", Type: field.TypeString, Nullable: true}, {Name: "deployment_stack", Type: field.TypeUUID, Unique: true, Nullable: true}, } // StacksTable holds the schema information for the "stacks" table. StacksTable = &schema.Table{ Name: "stacks", Columns: StacksColumns, PrimaryKey: []*schema.Column{StacksColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "stacks_deployments_stack", Columns: []*schema.Column{StacksColumns[13]}, RefColumns: []*schema.Column{DeploymentsColumns[0]}, OnDelete: schema.SetNull, }, }, } // TasksColumns holds the columns for the "tasks" table. TasksColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID, Unique: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "image", Type: field.TypeString}, {Name: "timeout", Type: field.TypeInt, Nullable: true}, {Name: "name", Type: field.TypeString, Nullable: true}, {Name: "cmd", Type: field.TypeString, Nullable: true}, {Name: "detached", Type: field.TypeBool, Nullable: true, Default: false}, {Name: "environment", Type: field.TypeJSON, Nullable: true}, {Name: "ports", Type: field.TypeJSON, Nullable: true}, {Name: "volumes", Type: field.TypeJSON, Nullable: true}, {Name: "restart", Type: field.TypeString, Nullable: true}, {Name: "security_opt", Type: field.TypeJSON, Nullable: true}, {Name: "cap_add", Type: field.TypeJSON, Nullable: true}, {Name: "deployment_tasks", Type: field.TypeUUID, Nullable: true}, {Name: "process_tasks", Type: field.TypeString, Nullable: true}, } // TasksTable holds the schema information for the "tasks" table. TasksTable = &schema.Table{ Name: "tasks", Columns: TasksColumns, PrimaryKey: []*schema.Column{TasksColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "tasks_deployments_tasks", Columns: []*schema.Column{TasksColumns[14]}, RefColumns: []*schema.Column{DeploymentsColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "tasks_processes_tasks", Columns: []*schema.Column{TasksColumns[15]}, RefColumns: []*schema.Column{ProcessesColumns[0]}, OnDelete: schema.SetNull, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ CredentialsTable, DeploymentsTable, ProcessesTable, ProvidersTable, StacksTable, TasksTable, } )
Functions ¶
This section is empty.
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.