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 ( // FmsCloudFilesColumns holds the columns for the "fms_cloud_files" table. FmsCloudFilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "state", Type: field.TypeBool, Nullable: true, Comment: "State true: normal false: ban | 状态 true 正常 false 禁用", Default: true}, {Name: "name", Type: field.TypeString, Comment: "The file's name | 文件名"}, {Name: "url", Type: field.TypeString, Comment: "The file's url | 文件地址"}, {Name: "size", Type: field.TypeUint64, Comment: "The file's size | 文件大小"}, {Name: "file_type", Type: field.TypeUint8, Comment: "The file's type | 文件类型"}, {Name: "user_id", Type: field.TypeString, Comment: "The user who upload the file | 上传用户的 ID"}, {Name: "cloud_file_storage_providers", Type: field.TypeUint64, Nullable: true}, } // FmsCloudFilesTable holds the schema information for the "fms_cloud_files" table. FmsCloudFilesTable = &schema.Table{ Name: "fms_cloud_files", Columns: FmsCloudFilesColumns, PrimaryKey: []*schema.Column{FmsCloudFilesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "fms_cloud_files_fms_storage_providers_storage_providers", Columns: []*schema.Column{FmsCloudFilesColumns[9]}, RefColumns: []*schema.Column{FmsStorageProvidersColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "cloudfile_name", Unique: false, Columns: []*schema.Column{FmsCloudFilesColumns[4]}, }, { Name: "cloudfile_file_type", Unique: false, Columns: []*schema.Column{FmsCloudFilesColumns[7]}, }, }, } // FmsCloudFileTagsColumns holds the columns for the "fms_cloud_file_tags" table. FmsCloudFileTagsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "CloudFileTag's name | 标签名称"}, {Name: "remark", Type: field.TypeString, Nullable: true, Comment: "The remark of tag | 标签的备注"}, } // FmsCloudFileTagsTable holds the schema information for the "fms_cloud_file_tags" table. FmsCloudFileTagsTable = &schema.Table{ Name: "fms_cloud_file_tags", Columns: FmsCloudFileTagsColumns, PrimaryKey: []*schema.Column{FmsCloudFileTagsColumns[0]}, Indexes: []*schema.Index{ { Name: "cloudfiletag_name", Unique: false, Columns: []*schema.Column{FmsCloudFileTagsColumns[4]}, }, }, } // FmsFilesColumns holds the columns for the "fms_files" table. FmsFilesColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "File's name | 文件名称"}, {Name: "file_type", Type: field.TypeUint8, Comment: "File's type | 文件类型"}, {Name: "size", Type: field.TypeUint64, Comment: "File's size | 文件大小"}, {Name: "path", Type: field.TypeString}, {Name: "user_id", Type: field.TypeString, Comment: "User's UUID | 用户的 UUID"}, {Name: "md5", Type: field.TypeString, Comment: "The md5 of the file | 文件的 md5"}, } // FmsFilesTable holds the schema information for the "fms_files" table. FmsFilesTable = &schema.Table{ Name: "fms_files", Columns: FmsFilesColumns, PrimaryKey: []*schema.Column{FmsFilesColumns[0]}, Indexes: []*schema.Index{ { Name: "file_user_id", Unique: false, Columns: []*schema.Column{FmsFilesColumns[8]}, }, { Name: "file_file_type", Unique: false, Columns: []*schema.Column{FmsFilesColumns[5]}, }, }, } // FmsFileTagsColumns holds the columns for the "fms_file_tags" table. FmsFileTagsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1}, {Name: "name", Type: field.TypeString, Comment: "FileTag's name | 标签名称"}, {Name: "remark", Type: field.TypeString, Nullable: true, Comment: "The remark of tag | 标签的备注"}, } // FmsFileTagsTable holds the schema information for the "fms_file_tags" table. FmsFileTagsTable = &schema.Table{ Name: "fms_file_tags", Columns: FmsFileTagsColumns, PrimaryKey: []*schema.Column{FmsFileTagsColumns[0]}, Indexes: []*schema.Index{ { Name: "filetag_name", Unique: false, Columns: []*schema.Column{FmsFileTagsColumns[4]}, }, }, } // FmsStorageProvidersColumns holds the columns for the "fms_storage_providers" table. FmsStorageProvidersColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint64, Increment: true}, {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"}, {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"}, {Name: "state", Type: field.TypeBool, Nullable: true, Comment: "State true: normal false: ban | 状态 true 正常 false 禁用", Default: true}, {Name: "name", Type: field.TypeString, Unique: true, Comment: "The cloud storage service name | 服务名称"}, {Name: "bucket", Type: field.TypeString, Comment: "The cloud storage bucket name | 云存储服务的存储桶"}, {Name: "secret_id", Type: field.TypeString, Comment: "The secret ID | 密钥 ID"}, {Name: "secret_key", Type: field.TypeString, Comment: "The secret key | 密钥 Key"}, {Name: "endpoint", Type: field.TypeString, Comment: "The service URL | 服务器地址"}, {Name: "folder", Type: field.TypeString, Nullable: true, Comment: "The folder in cloud | 云服务目标文件夹"}, {Name: "region", Type: field.TypeString, Comment: "The service region | 服务器所在地区"}, {Name: "is_default", Type: field.TypeBool, Comment: "Is it the default provider | 是否为默认提供商", Default: false}, } // FmsStorageProvidersTable holds the schema information for the "fms_storage_providers" table. FmsStorageProvidersTable = &schema.Table{ Name: "fms_storage_providers", Columns: FmsStorageProvidersColumns, PrimaryKey: []*schema.Column{FmsStorageProvidersColumns[0]}, } // CloudFileTagCloudFilesColumns holds the columns for the "cloud_file_tag_cloud_files" table. CloudFileTagCloudFilesColumns = []*schema.Column{ {Name: "cloud_file_tag_id", Type: field.TypeUint64}, {Name: "cloud_file_id", Type: field.TypeUUID}, } // CloudFileTagCloudFilesTable holds the schema information for the "cloud_file_tag_cloud_files" table. CloudFileTagCloudFilesTable = &schema.Table{ Name: "cloud_file_tag_cloud_files", Columns: CloudFileTagCloudFilesColumns, PrimaryKey: []*schema.Column{CloudFileTagCloudFilesColumns[0], CloudFileTagCloudFilesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "cloud_file_tag_cloud_files_cloud_file_tag_id", Columns: []*schema.Column{CloudFileTagCloudFilesColumns[0]}, RefColumns: []*schema.Column{FmsCloudFileTagsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "cloud_file_tag_cloud_files_cloud_file_id", Columns: []*schema.Column{CloudFileTagCloudFilesColumns[1]}, RefColumns: []*schema.Column{FmsCloudFilesColumns[0]}, OnDelete: schema.Cascade, }, }, } // FileTagFilesColumns holds the columns for the "file_tag_files" table. FileTagFilesColumns = []*schema.Column{ {Name: "file_tag_id", Type: field.TypeUint64}, {Name: "file_id", Type: field.TypeUUID}, } // FileTagFilesTable holds the schema information for the "file_tag_files" table. FileTagFilesTable = &schema.Table{ Name: "file_tag_files", Columns: FileTagFilesColumns, PrimaryKey: []*schema.Column{FileTagFilesColumns[0], FileTagFilesColumns[1]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "file_tag_files_file_tag_id", Columns: []*schema.Column{FileTagFilesColumns[0]}, RefColumns: []*schema.Column{FmsFileTagsColumns[0]}, OnDelete: schema.Cascade, }, { Symbol: "file_tag_files_file_id", Columns: []*schema.Column{FileTagFilesColumns[1]}, RefColumns: []*schema.Column{FmsFilesColumns[0]}, OnDelete: schema.Cascade, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ FmsCloudFilesTable, FmsCloudFileTagsTable, FmsFilesTable, FmsFileTagsTable, FmsStorageProvidersTable, CloudFileTagCloudFilesTable, FileTagFilesTable, } )
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.