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 ( // NodesColumns holds the columns for the "nodes" table. NodesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // NodesTable holds the schema information for the "nodes" table. NodesTable = &schema.Table{ Name: "nodes", Columns: NodesColumns, PrimaryKey: []*schema.Column{NodesColumns[0]}, } // UsersColumns holds the columns for the "users" table. UsersColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // UsersTable holds the schema information for the "users" table. UsersTable = &schema.Table{ Name: "users", Columns: UsersColumns, PrimaryKey: []*schema.Column{UsersColumns[0]}, } // WebformsColumns holds the columns for the "webforms" table. WebformsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "mediumtext"}}, {Name: "confirmation", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "mediumtext"}}, {Name: "confirmation_url", Type: field.TypeString, Size: 500, Default: ""}, {Name: "submit_label", Type: field.TypeString, Size: 128, Default: ""}, {Name: "closed", Type: field.TypeBool, Default: false}, {Name: "notify_email", Type: field.TypeString, Size: 500, Default: ""}, {Name: "limit_per_user", Type: field.TypeBool, Default: false}, {Name: "max_submissions", Type: field.TypeInt, Default: 0, SchemaType: map[string]string{"mysql": "int"}}, {Name: "closes_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "nid", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // WebformsTable holds the schema information for the "webforms" table. WebformsTable = &schema.Table{ Name: "webforms", Columns: WebformsColumns, PrimaryKey: []*schema.Column{WebformsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "webforms_nodes_node", Columns: []*schema.Column{WebformsColumns[10]}, RefColumns: []*schema.Column{NodesColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "webforms_nid", Unique: true, Columns: []*schema.Column{WebformsColumns[10]}, }, }, } // WebformElementsColumns holds the columns for the "webform_elements" table. WebformElementsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "machine_name", Type: field.TypeString, Size: 64}, {Name: "type", Type: field.TypeString, Size: 32}, {Name: "label", Type: field.TypeString, Size: 500}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "text"}}, {Name: "required", Type: field.TypeBool, Default: false}, {Name: "options", Type: field.TypeString, Nullable: true, Size: 2147483647, SchemaType: map[string]string{"mysql": "text"}}, {Name: "weight", Type: field.TypeInt, Default: 0, SchemaType: map[string]string{"mysql": "int"}}, {Name: "visible_if_element", Type: field.TypeString, Size: 64, Default: ""}, {Name: "visible_if_value", Type: field.TypeString, Size: 500, Default: ""}, {Name: "prefill_param", Type: field.TypeString, Size: 64, Default: ""}, {Name: "webform_id", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // WebformElementsTable holds the schema information for the "webform_elements" table. WebformElementsTable = &schema.Table{ Name: "webform_elements", Columns: WebformElementsColumns, PrimaryKey: []*schema.Column{WebformElementsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "webform_elements_webforms_elements", Columns: []*schema.Column{WebformElementsColumns[11]}, RefColumns: []*schema.Column{WebformsColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "webform_elements_key", Unique: true, Columns: []*schema.Column{WebformElementsColumns[11], WebformElementsColumns[1]}, }, }, } // WebformSubmissionsColumns holds the columns for the "webform_submissions" table. WebformSubmissionsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "remote_ip", Type: field.TypeString, Size: 64, Default: ""}, {Name: "source_url", Type: field.TypeString, Size: 500, Default: ""}, {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}}, {Name: "webform_id", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "user_id", Type: field.TypeInt, Nullable: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // WebformSubmissionsTable holds the schema information for the "webform_submissions" table. WebformSubmissionsTable = &schema.Table{ Name: "webform_submissions", Columns: WebformSubmissionsColumns, PrimaryKey: []*schema.Column{WebformSubmissionsColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "webform_submissions_webforms_submissions", Columns: []*schema.Column{WebformSubmissionsColumns[4]}, RefColumns: []*schema.Column{WebformsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "webform_submissions_users_user", Columns: []*schema.Column{WebformSubmissionsColumns[5]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "webformsubmission_webform_id_created_at", Unique: false, Columns: []*schema.Column{WebformSubmissionsColumns[4], WebformSubmissionsColumns[3]}, }, { Name: "webformsubmission_user_id", Unique: false, Columns: []*schema.Column{WebformSubmissionsColumns[5]}, }, }, } // WebformSubmissionValuesColumns holds the columns for the "webform_submission_values" table. WebformSubmissionValuesColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "delta", Type: field.TypeInt, Default: 0, SchemaType: map[string]string{"mysql": "int"}}, {Name: "value", Type: field.TypeString, Size: 2147483647, SchemaType: map[string]string{"mysql": "mediumtext"}}, {Name: "element_id", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, {Name: "submission_id", Type: field.TypeInt, SchemaType: map[string]string{"mysql": "int unsigned"}}, } // WebformSubmissionValuesTable holds the schema information for the "webform_submission_values" table. WebformSubmissionValuesTable = &schema.Table{ Name: "webform_submission_values", Columns: WebformSubmissionValuesColumns, PrimaryKey: []*schema.Column{WebformSubmissionValuesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "webform_submission_values_webform_elements_values", Columns: []*schema.Column{WebformSubmissionValuesColumns[3]}, RefColumns: []*schema.Column{WebformElementsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "webform_submission_values_webform_submissions_values", Columns: []*schema.Column{WebformSubmissionValuesColumns[4]}, RefColumns: []*schema.Column{WebformSubmissionsColumns[0]}, OnDelete: schema.Cascade, }, }, Indexes: []*schema.Index{ { Name: "webformsubmissionvalue_element_id", Unique: false, Columns: []*schema.Column{WebformSubmissionValuesColumns[3]}, }, { Name: "webformsubmissionvalue_submission_id", Unique: false, Columns: []*schema.Column{WebformSubmissionValuesColumns[4]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ NodesTable, UsersTable, WebformsTable, WebformElementsTable, WebformSubmissionsTable, WebformSubmissionValuesTable, } )
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.