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 ( // GroupsxColumns holds the columns for the "groupsx" table. GroupsxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "workspace_groups", Type: field.TypeUUID, Nullable: true}, } // GroupsxTable holds the schema information for the "groupsx" table. GroupsxTable = &schema.Table{ Name: "groupsx", Columns: GroupsxColumns, PrimaryKey: []*schema.Column{GroupsxColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "groupsx_workspacesx_groups", Columns: []*schema.Column{GroupsxColumns[6]}, RefColumns: []*schema.Column{WorkspacesxColumns[0]}, OnDelete: schema.SetNull, }, }, Annotation: &entsql.Annotation{Table: "groupsx"}, } // GrouprolesxColumns holds the columns for the "grouprolesx" table. GrouprolesxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "group_id", Type: field.TypeUUID}, {Name: "user_id", Type: field.TypeUUID}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "group_group_roles", Type: field.TypeUUID, Nullable: true}, {Name: "user_group_roles", Type: field.TypeUUID, Nullable: true}, } // GrouprolesxTable holds the schema information for the "grouprolesx" table. GrouprolesxTable = &schema.Table{ Name: "grouprolesx", Columns: GrouprolesxColumns, PrimaryKey: []*schema.Column{GrouprolesxColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "grouprolesx_groupsx_group_roles", Columns: []*schema.Column{GrouprolesxColumns[7]}, RefColumns: []*schema.Column{GroupsxColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "grouprolesx_usersx_group_roles", Columns: []*schema.Column{GrouprolesxColumns[8]}, RefColumns: []*schema.Column{UsersxColumns[0]}, OnDelete: schema.SetNull, }, }, Annotation: &entsql.Annotation{Table: "grouprolesx"}, } // PermissionsxColumns holds the columns for the "permissionsx" table. PermissionsxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "role_id", Type: field.TypeUUID}, {Name: "action", Type: field.TypeString}, {Name: "target", Type: field.TypeString}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, } // PermissionsxTable holds the schema information for the "permissionsx" table. PermissionsxTable = &schema.Table{ Name: "permissionsx", Columns: PermissionsxColumns, PrimaryKey: []*schema.Column{PermissionsxColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, Annotation: &entsql.Annotation{Table: "permissionsx"}, } // SessionsxColumns holds the columns for the "sessionsx" table. SessionsxColumns = []*schema.Column{ {Name: "id", Type: field.TypeString}, {Name: "data", Type: field.TypeString, Size: 2147483647}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "expires_at", Type: field.TypeTime, Nullable: true}, } // SessionsxTable holds the schema information for the "sessionsx" table. SessionsxTable = &schema.Table{ Name: "sessionsx", Columns: SessionsxColumns, PrimaryKey: []*schema.Column{SessionsxColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, Annotation: &entsql.Annotation{Table: "sessionsx"}, } // UsersxColumns holds the columns for the "usersx" table. UsersxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "billing_id", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "provider", Type: field.TypeString}, {Name: "email", Type: field.TypeString, Unique: true}, {Name: "password", Type: field.TypeString}, {Name: "api_key", Type: field.TypeString, Nullable: true}, {Name: "confirmed", Type: field.TypeBool, Nullable: true}, {Name: "confirmation_sent_at", Type: field.TypeTime, Nullable: true}, {Name: "confirmation_token", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "recovery_sent_at", Type: field.TypeTime, Nullable: true}, {Name: "recovery_token", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "otp_sent_at", Type: field.TypeTime, Nullable: true}, {Name: "otp", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "email_change", Type: field.TypeString, Nullable: true}, {Name: "email_change_sent_at", Type: field.TypeTime, Nullable: true}, {Name: "email_change_token", Type: field.TypeString, Unique: true, Nullable: true}, {Name: "metadata", Type: field.TypeJSON}, {Name: "roles", Type: field.TypeJSON, Nullable: true}, {Name: "teams", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "last_signin_at", Type: field.TypeTime, Nullable: true}, } // UsersxTable holds the schema information for the "usersx" table. UsersxTable = &schema.Table{ Name: "usersx", Columns: UsersxColumns, PrimaryKey: []*schema.Column{UsersxColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, Annotation: &entsql.Annotation{Table: "usersx"}, } // UserrolesxColumns holds the columns for the "userrolesx" table. UserrolesxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "user_id", Type: field.TypeUUID}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "user_user_roles", Type: field.TypeUUID, Nullable: true}, } // UserrolesxTable holds the schema information for the "userrolesx" table. UserrolesxTable = &schema.Table{ Name: "userrolesx", Columns: UserrolesxColumns, PrimaryKey: []*schema.Column{UserrolesxColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "userrolesx_usersx_user_roles", Columns: []*schema.Column{UserrolesxColumns[6]}, RefColumns: []*schema.Column{UsersxColumns[0]}, OnDelete: schema.SetNull, }, }, Annotation: &entsql.Annotation{Table: "userrolesx"}, } // WorkspacesxColumns holds the columns for the "workspacesx" table. WorkspacesxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "plan", Type: field.TypeString}, {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "user_workspace", Type: field.TypeUUID, Unique: true, Nullable: true}, } // WorkspacesxTable holds the schema information for the "workspacesx" table. WorkspacesxTable = &schema.Table{ Name: "workspacesx", Columns: WorkspacesxColumns, PrimaryKey: []*schema.Column{WorkspacesxColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "workspacesx_usersx_workspace", Columns: []*schema.Column{WorkspacesxColumns[7]}, RefColumns: []*schema.Column{UsersxColumns[0]}, OnDelete: schema.SetNull, }, }, Annotation: &entsql.Annotation{Table: "workspacesx"}, } // WorkspacerolesxColumns holds the columns for the "workspacerolesx" table. WorkspacerolesxColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "name", Type: field.TypeString}, {Name: "workspace_id", Type: field.TypeUUID}, {Name: "user_id", Type: field.TypeUUID}, {Name: "metadata", Type: field.TypeJSON, Nullable: true}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "user_workspace_roles", Type: field.TypeUUID, Nullable: true}, {Name: "workspace_workspace_roles", Type: field.TypeUUID, Nullable: true}, } // WorkspacerolesxTable holds the schema information for the "workspacerolesx" table. WorkspacerolesxTable = &schema.Table{ Name: "workspacerolesx", Columns: WorkspacerolesxColumns, PrimaryKey: []*schema.Column{WorkspacerolesxColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "workspacerolesx_usersx_workspace_roles", Columns: []*schema.Column{WorkspacerolesxColumns[7]}, RefColumns: []*schema.Column{UsersxColumns[0]}, OnDelete: schema.SetNull, }, { Symbol: "workspacerolesx_workspacesx_workspace_roles", Columns: []*schema.Column{WorkspacerolesxColumns[8]}, RefColumns: []*schema.Column{WorkspacesxColumns[0]}, OnDelete: schema.SetNull, }, }, Annotation: &entsql.Annotation{Table: "workspacerolesx"}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ GroupsxTable, GrouprolesxTable, PermissionsxTable, SessionsxTable, UsersxTable, UserrolesxTable, WorkspacesxTable, WorkspacerolesxTable, } )
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.