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 ( // APIAuditsColumns holds the columns for the "api_audits" table. APIAuditsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "plane", Type: field.TypeString}, {Name: "hashed_grant_token", Type: field.TypeString, Nullable: true}, {Name: "domain", Type: field.TypeString, Nullable: true}, {Name: "http_path", Type: field.TypeString, Nullable: true}, {Name: "http_method", Type: field.TypeString, Nullable: true}, {Name: "sent_http_status", Type: field.TypeInt, Nullable: true}, } // APIAuditsTable holds the schema information for the "api_audits" table. APIAuditsTable = &schema.Table{ Name: "api_audits", Columns: APIAuditsColumns, PrimaryKey: []*schema.Column{APIAuditsColumns[0]}, Indexes: []*schema.Index{ { Name: "apiaudit_id", Unique: true, Columns: []*schema.Column{APIAuditsColumns[0]}, }, { Name: "apiaudit_created_at", Unique: false, Columns: []*schema.Column{APIAuditsColumns[1]}, }, { Name: "apiaudit_updated_at", Unique: false, Columns: []*schema.Column{APIAuditsColumns[2]}, }, { Name: "apiaudit_deleted_at", Unique: false, Columns: []*schema.Column{APIAuditsColumns[3]}, }, { Name: "apiaudit_plane", Unique: false, Columns: []*schema.Column{APIAuditsColumns[4]}, }, { Name: "apiaudit_hashed_grant_token", Unique: false, Columns: []*schema.Column{APIAuditsColumns[5]}, }, { Name: "apiaudit_domain", Unique: false, Columns: []*schema.Column{APIAuditsColumns[6]}, }, { Name: "apiaudit_http_path", Unique: false, Columns: []*schema.Column{APIAuditsColumns[7]}, }, { Name: "apiaudit_http_method", Unique: false, Columns: []*schema.Column{APIAuditsColumns[8]}, }, { Name: "apiaudit_sent_http_status", Unique: false, Columns: []*schema.Column{APIAuditsColumns[9]}, }, }, } // FactsColumns holds the columns for the "facts" table. FactsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "hashed_value", Type: field.TypeString}, {Name: "encrypted_value", Type: field.TypeString}, {Name: "domain", Type: field.TypeString}, {Name: "collection", Type: field.TypeString}, {Name: "key", Type: field.TypeString}, {Name: "blind_indexes", Type: field.TypeJSON}, {Name: "scope_facts", Type: field.TypeString, Nullable: true, Size: 255}, } // FactsTable holds the schema information for the "facts" table. FactsTable = &schema.Table{ Name: "facts", Columns: FactsColumns, PrimaryKey: []*schema.Column{FactsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "facts_scopes_facts", Columns: []*schema.Column{FactsColumns[10]}, RefColumns: []*schema.Column{ScopesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "fact_id", Unique: true, Columns: []*schema.Column{FactsColumns[0]}, }, { Name: "fact_created_at", Unique: false, Columns: []*schema.Column{FactsColumns[1]}, }, { Name: "fact_updated_at", Unique: false, Columns: []*schema.Column{FactsColumns[2]}, }, { Name: "fact_deleted_at", Unique: false, Columns: []*schema.Column{FactsColumns[3]}, }, { Name: "fact_hashed_value", Unique: false, Columns: []*schema.Column{FactsColumns[4]}, }, { Name: "fact_domain", Unique: false, Columns: []*schema.Column{FactsColumns[6]}, }, }, } // GrantsColumns holds the columns for the "grants" table. GrantsColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "hashed_grant_token", Type: field.TypeString}, {Name: "domain", Type: field.TypeString}, {Name: "version", Type: field.TypeString}, {Name: "allowed_http_methods", Type: field.TypeString}, {Name: "paths", Type: field.TypeJSON}, } // GrantsTable holds the schema information for the "grants" table. GrantsTable = &schema.Table{ Name: "grants", Columns: GrantsColumns, PrimaryKey: []*schema.Column{GrantsColumns[0]}, Indexes: []*schema.Index{ { Name: "grant_id", Unique: true, Columns: []*schema.Column{GrantsColumns[0]}, }, { Name: "grant_created_at", Unique: false, Columns: []*schema.Column{GrantsColumns[1]}, }, { Name: "grant_updated_at", Unique: false, Columns: []*schema.Column{GrantsColumns[2]}, }, { Name: "grant_deleted_at", Unique: false, Columns: []*schema.Column{GrantsColumns[3]}, }, { Name: "grant_hashed_grant_token", Unique: false, Columns: []*schema.Column{GrantsColumns[4]}, }, { Name: "grant_domain", Unique: false, Columns: []*schema.Column{GrantsColumns[5]}, }, }, } // ScopesColumns holds the columns for the "scopes" table. ScopesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Size: 255}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "custom_id", Type: field.TypeString}, {Name: "nonce", Type: field.TypeString}, {Name: "domain", Type: field.TypeString}, } // ScopesTable holds the schema information for the "scopes" table. ScopesTable = &schema.Table{ Name: "scopes", Columns: ScopesColumns, PrimaryKey: []*schema.Column{ScopesColumns[0]}, Indexes: []*schema.Index{ { Name: "scope_id", Unique: true, Columns: []*schema.Column{ScopesColumns[0]}, }, { Name: "scope_created_at", Unique: false, Columns: []*schema.Column{ScopesColumns[1]}, }, { Name: "scope_updated_at", Unique: false, Columns: []*schema.Column{ScopesColumns[2]}, }, { Name: "scope_deleted_at", Unique: false, Columns: []*schema.Column{ScopesColumns[3]}, }, { Name: "scope_custom_id", Unique: true, Columns: []*schema.Column{ScopesColumns[4]}, }, { Name: "scope_domain", Unique: false, Columns: []*schema.Column{ScopesColumns[6]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ APIAuditsTable, FactsTable, GrantsTable, ScopesTable, } )
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.