You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudreve/ent/migrate/schema.go

992 lines
42 KiB

// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// AbuseReportsColumns holds the columns for the "abuse_reports" table.
AbuseReportsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "reporter_id", Type: field.TypeInt, Nullable: true},
{Name: "reporter_email", Type: field.TypeString, Nullable: true},
{Name: "target_type", Type: field.TypeString},
{Name: "target_id", Type: field.TypeInt},
{Name: "reason", Type: field.TypeInt},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeString, Default: "open"},
{Name: "admin_note", Type: field.TypeString, Nullable: true},
}
// AbuseReportsTable holds the schema information for the "abuse_reports" table.
AbuseReportsTable = &schema.Table{
Name: "abuse_reports",
Columns: AbuseReportsColumns,
PrimaryKey: []*schema.Column{AbuseReportsColumns[0]},
Indexes: []*schema.Index{
{
Name: "abusereport_status_created_at",
Unique: false,
Columns: []*schema.Column{AbuseReportsColumns[10], AbuseReportsColumns[1]},
},
{
Name: "abusereport_target_type_target_id",
Unique: false,
Columns: []*schema.Column{AbuseReportsColumns[6], AbuseReportsColumns[7]},
},
},
}
// ACLEntriesColumns holds the columns for the "acl_entries" table.
ACLEntriesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "subject_type", Type: field.TypeEnum, Enums: []string{"user", "group", "anonymous", "everyone"}},
{Name: "subject_id", Type: field.TypeInt, Nullable: true},
{Name: "permissions", Type: field.TypeBytes},
{Name: "file_id", Type: field.TypeInt},
}
// ACLEntriesTable holds the schema information for the "acl_entries" table.
ACLEntriesTable = &schema.Table{
Name: "acl_entries",
Columns: ACLEntriesColumns,
PrimaryKey: []*schema.Column{ACLEntriesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "acl_entries_files_acl_entries",
Columns: []*schema.Column{ACLEntriesColumns[7]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "aclentry_file_id_subject_type_subject_id",
Unique: true,
Columns: []*schema.Column{ACLEntriesColumns[7], ACLEntriesColumns[4], ACLEntriesColumns[5]},
},
},
}
// ActivityEventsColumns holds the columns for the "activity_events" table.
ActivityEventsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "type", Type: field.TypeInt},
{Name: "actor_id", Type: field.TypeInt, Nullable: true},
{Name: "ip", Type: field.TypeString, Nullable: true},
{Name: "cid", Type: field.TypeString, Nullable: true},
{Name: "file_id", Type: field.TypeInt, Nullable: true},
{Name: "share_id", Type: field.TypeInt, Nullable: true},
{Name: "extra", Type: field.TypeJSON, Nullable: true},
}
// ActivityEventsTable holds the schema information for the "activity_events" table.
ActivityEventsTable = &schema.Table{
Name: "activity_events",
Columns: ActivityEventsColumns,
PrimaryKey: []*schema.Column{ActivityEventsColumns[0]},
Indexes: []*schema.Index{
{
Name: "activityevent_created_at",
Unique: false,
Columns: []*schema.Column{ActivityEventsColumns[1]},
},
{
Name: "activityevent_type_created_at",
Unique: false,
Columns: []*schema.Column{ActivityEventsColumns[4], ActivityEventsColumns[1]},
},
{
Name: "activityevent_file_id_created_at",
Unique: false,
Columns: []*schema.Column{ActivityEventsColumns[8], ActivityEventsColumns[1]},
},
{
Name: "activityevent_actor_id_created_at",
Unique: false,
Columns: []*schema.Column{ActivityEventsColumns[5], ActivityEventsColumns[1]},
},
{
Name: "activityevent_share_id_created_at",
Unique: false,
Columns: []*schema.Column{ActivityEventsColumns[9], ActivityEventsColumns[1]},
},
},
}
// CreditTxnsColumns holds the columns for the "credit_txns" table.
CreditTxnsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "amount", Type: field.TypeInt64},
{Name: "type", Type: field.TypeEnum, Enums: []string{"purchase", "gift", "share_income", "adjust"}},
{Name: "ref", Type: field.TypeString, Nullable: true},
{Name: "des", Type: field.TypeString, Nullable: true},
{Name: "user_id", Type: field.TypeInt},
}
// CreditTxnsTable holds the schema information for the "credit_txns" table.
CreditTxnsTable = &schema.Table{
Name: "credit_txns",
Columns: CreditTxnsColumns,
PrimaryKey: []*schema.Column{CreditTxnsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "credit_txns_users_credit_txns",
Columns: []*schema.Column{CreditTxnsColumns[8]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "credittxn_user_id_created_at",
Unique: false,
Columns: []*schema.Column{CreditTxnsColumns[8], CreditTxnsColumns[1]},
},
},
}
// DavAccountsColumns holds the columns for the "dav_accounts" table.
DavAccountsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "uri", Type: field.TypeString, Size: 2147483647},
{Name: "password", Type: field.TypeString},
{Name: "options", Type: field.TypeBytes},
{Name: "props", Type: field.TypeJSON, Nullable: true},
{Name: "owner_id", Type: field.TypeInt},
}
// DavAccountsTable holds the schema information for the "dav_accounts" table.
DavAccountsTable = &schema.Table{
Name: "dav_accounts",
Columns: DavAccountsColumns,
PrimaryKey: []*schema.Column{DavAccountsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "dav_accounts_users_dav_accounts",
Columns: []*schema.Column{DavAccountsColumns[9]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "davaccount_owner_id_password",
Unique: true,
Columns: []*schema.Column{DavAccountsColumns[9], DavAccountsColumns[6]},
},
},
}
// DirectLinksColumns holds the columns for the "direct_links" table.
DirectLinksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "downloads", Type: field.TypeInt},
{Name: "speed", Type: field.TypeInt},
{Name: "file_id", Type: field.TypeInt},
}
// DirectLinksTable holds the schema information for the "direct_links" table.
DirectLinksTable = &schema.Table{
Name: "direct_links",
Columns: DirectLinksColumns,
PrimaryKey: []*schema.Column{DirectLinksColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "direct_links_files_direct_links",
Columns: []*schema.Column{DirectLinksColumns[7]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// EntitiesColumns holds the columns for the "entities" table.
EntitiesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "type", Type: field.TypeInt},
{Name: "source", Type: field.TypeString, Size: 2147483647},
{Name: "size", Type: field.TypeInt64},
{Name: "reference_count", Type: field.TypeInt, Default: 1},
{Name: "hash", Type: field.TypeString, Nullable: true, Size: 64},
{Name: "upload_session_id", Type: field.TypeUUID, Nullable: true},
{Name: "recycle_options", Type: field.TypeJSON, Nullable: true},
{Name: "storage_policy_entities", Type: field.TypeInt},
{Name: "created_by", Type: field.TypeInt, Nullable: true},
}
// EntitiesTable holds the schema information for the "entities" table.
EntitiesTable = &schema.Table{
Name: "entities",
Columns: EntitiesColumns,
PrimaryKey: []*schema.Column{EntitiesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "entities_storage_policies_entities",
Columns: []*schema.Column{EntitiesColumns[11]},
RefColumns: []*schema.Column{StoragePoliciesColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "entities_users_entities",
Columns: []*schema.Column{EntitiesColumns[12]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},
},
Indexes: []*schema.Index{
{
Name: "entity_hash_size",
Unique: false,
Columns: []*schema.Column{EntitiesColumns[8], EntitiesColumns[6]},
},
},
}
// FilesColumns holds the columns for the "files" table.
FilesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "type", Type: field.TypeInt},
{Name: "name", Type: field.TypeString},
{Name: "size", Type: field.TypeInt64, Default: 0},
{Name: "primary_entity", Type: field.TypeInt, Nullable: true},
{Name: "is_symbolic", Type: field.TypeBool, Default: false},
{Name: "props", Type: field.TypeJSON, Nullable: true},
{Name: "file_children", Type: field.TypeInt, Nullable: true},
{Name: "storage_policy_files", Type: field.TypeInt, Nullable: true},
{Name: "owner_id", Type: field.TypeInt},
}
// FilesTable holds the schema information for the "files" table.
FilesTable = &schema.Table{
Name: "files",
Columns: FilesColumns,
PrimaryKey: []*schema.Column{FilesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "files_files_children",
Columns: []*schema.Column{FilesColumns[9]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "files_storage_policies_files",
Columns: []*schema.Column{FilesColumns[10]},
RefColumns: []*schema.Column{StoragePoliciesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "files_users_files",
Columns: []*schema.Column{FilesColumns[11]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "file_file_children_name",
Unique: true,
Columns: []*schema.Column{FilesColumns[9], FilesColumns[4]},
},
{
Name: "file_file_children_type_updated_at",
Unique: false,
Columns: []*schema.Column{FilesColumns[9], FilesColumns[3], FilesColumns[2]},
},
{
Name: "file_file_children_type_created_at",
Unique: false,
Columns: []*schema.Column{FilesColumns[9], FilesColumns[3], FilesColumns[1]},
},
{
Name: "file_file_children_type_size",
Unique: false,
Columns: []*schema.Column{FilesColumns[9], FilesColumns[3], FilesColumns[5]},
},
},
}
// FsEventsColumns holds the columns for the "fs_events" table.
FsEventsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "event", Type: field.TypeString, Size: 2147483647},
{Name: "subscriber", Type: field.TypeUUID},
{Name: "user_fsevent", Type: field.TypeInt, Nullable: true},
}
// FsEventsTable holds the schema information for the "fs_events" table.
FsEventsTable = &schema.Table{
Name: "fs_events",
Columns: FsEventsColumns,
PrimaryKey: []*schema.Column{FsEventsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "fs_events_users_fsevents",
Columns: []*schema.Column{FsEventsColumns[6]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// GiftCodesColumns holds the columns for the "gift_codes" table.
GiftCodesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "code", Type: field.TypeString, Unique: true},
{Name: "type", Type: field.TypeEnum, Enums: []string{"points", "storage", "group"}},
{Name: "amount", Type: field.TypeInt64},
{Name: "duration", Type: field.TypeInt64, Nullable: true},
{Name: "used_at", Type: field.TypeTime, Nullable: true},
{Name: "des", Type: field.TypeString, Nullable: true},
{Name: "used_by_id", Type: field.TypeInt, Nullable: true},
}
// GiftCodesTable holds the schema information for the "gift_codes" table.
GiftCodesTable = &schema.Table{
Name: "gift_codes",
Columns: GiftCodesColumns,
PrimaryKey: []*schema.Column{GiftCodesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "gift_codes_users_redeemed_codes",
Columns: []*schema.Column{GiftCodesColumns[10]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// GroupsColumns holds the columns for the "groups" table.
GroupsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "max_storage", Type: field.TypeInt64, Nullable: true},
{Name: "speed_limit", Type: field.TypeInt, Nullable: true},
{Name: "permissions", Type: field.TypeBytes},
{Name: "settings", Type: field.TypeJSON, Nullable: true},
{Name: "storage_policy_id", Type: field.TypeInt, Nullable: true},
}
// GroupsTable holds the schema information for the "groups" table.
GroupsTable = &schema.Table{
Name: "groups",
Columns: GroupsColumns,
PrimaryKey: []*schema.Column{GroupsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "groups_storage_policies_groups",
Columns: []*schema.Column{GroupsColumns[9]},
RefColumns: []*schema.Column{StoragePoliciesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// InvitationCodesColumns holds the columns for the "invitation_codes" table.
InvitationCodesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "group_id", Type: field.TypeInt, Default: 0},
{Name: "max_uses", Type: field.TypeInt, Default: 1},
{Name: "used_count", Type: field.TypeInt, Default: 0},
{Name: "expires_at", Type: field.TypeTime, Nullable: true},
}
// InvitationCodesTable holds the schema information for the "invitation_codes" table.
InvitationCodesTable = &schema.Table{
Name: "invitation_codes",
Columns: InvitationCodesColumns,
PrimaryKey: []*schema.Column{InvitationCodesColumns[0]},
}
// MetadataColumns holds the columns for the "metadata" table.
MetadataColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "value", Type: field.TypeString, Size: 2147483647},
{Name: "is_public", Type: field.TypeBool, Default: false},
{Name: "file_id", Type: field.TypeInt},
}
// MetadataTable holds the schema information for the "metadata" table.
MetadataTable = &schema.Table{
Name: "metadata",
Columns: MetadataColumns,
PrimaryKey: []*schema.Column{MetadataColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "metadata_files_metadata",
Columns: []*schema.Column{MetadataColumns[7]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "metadata_file_id_name",
Unique: true,
Columns: []*schema.Column{MetadataColumns[7], MetadataColumns[4]},
},
},
}
// NodesColumns holds the columns for the "nodes" table.
NodesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "suspended"}},
{Name: "name", Type: field.TypeString},
{Name: "type", Type: field.TypeEnum, Enums: []string{"master", "slave"}},
{Name: "server", Type: field.TypeString, Nullable: true},
{Name: "slave_key", Type: field.TypeString, Nullable: true},
{Name: "capabilities", Type: field.TypeBytes},
{Name: "settings", Type: field.TypeJSON, Nullable: true},
{Name: "weight", Type: field.TypeInt, Default: 0},
}
// NodesTable holds the schema information for the "nodes" table.
NodesTable = &schema.Table{
Name: "nodes",
Columns: NodesColumns,
PrimaryKey: []*schema.Column{NodesColumns[0]},
}
// OauthClientsColumns holds the columns for the "oauth_clients" table.
OauthClientsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "guid", Type: field.TypeString, Unique: true, Size: 255},
{Name: "secret", Type: field.TypeString, Size: 255},
{Name: "name", Type: field.TypeString, Size: 255},
{Name: "homepage_url", Type: field.TypeString, Nullable: true, Size: 2048},
{Name: "redirect_uris", Type: field.TypeJSON},
{Name: "scopes", Type: field.TypeJSON},
{Name: "props", Type: field.TypeJSON},
{Name: "is_enabled", Type: field.TypeBool, Default: true},
}
// OauthClientsTable holds the schema information for the "oauth_clients" table.
OauthClientsTable = &schema.Table{
Name: "oauth_clients",
Columns: OauthClientsColumns,
PrimaryKey: []*schema.Column{OauthClientsColumns[0]},
}
// OauthGrantsColumns holds the columns for the "oauth_grants" table.
OauthGrantsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "scopes", Type: field.TypeJSON},
{Name: "last_used_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "client_id", Type: field.TypeInt},
{Name: "user_id", Type: field.TypeInt},
}
// OauthGrantsTable holds the schema information for the "oauth_grants" table.
OauthGrantsTable = &schema.Table{
Name: "oauth_grants",
Columns: OauthGrantsColumns,
PrimaryKey: []*schema.Column{OauthGrantsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "oauth_grants_oauth_clients_grants",
Columns: []*schema.Column{OauthGrantsColumns[6]},
RefColumns: []*schema.Column{OauthClientsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "oauth_grants_users_oauth_grants",
Columns: []*schema.Column{OauthGrantsColumns[7]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "oauthgrant_user_id_client_id",
Unique: true,
Columns: []*schema.Column{OauthGrantsColumns[7], OauthGrantsColumns[6]},
},
},
}
// PasskeysColumns holds the columns for the "passkeys" table.
PasskeysColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "credential_id", Type: field.TypeString},
{Name: "name", Type: field.TypeString},
{Name: "credential", Type: field.TypeJSON},
{Name: "used_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "user_id", Type: field.TypeInt},
}
// PasskeysTable holds the schema information for the "passkeys" table.
PasskeysTable = &schema.Table{
Name: "passkeys",
Columns: PasskeysColumns,
PrimaryKey: []*schema.Column{PasskeysColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "passkeys_users_passkey",
Columns: []*schema.Column{PasskeysColumns[8]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "passkey_user_id_credential_id",
Unique: true,
Columns: []*schema.Column{PasskeysColumns[8], PasskeysColumns[4]},
},
},
}
// SettingsColumns holds the columns for the "settings" table.
SettingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString, Unique: true},
{Name: "value", Type: field.TypeString, Nullable: true, Size: 2147483647},
}
// SettingsTable holds the schema information for the "settings" table.
SettingsTable = &schema.Table{
Name: "settings",
Columns: SettingsColumns,
PrimaryKey: []*schema.Column{SettingsColumns[0]},
}
// SharesColumns holds the columns for the "shares" table.
SharesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "password", Type: field.TypeString, Nullable: true},
{Name: "views", Type: field.TypeInt, Default: 0},
{Name: "downloads", Type: field.TypeInt, Default: 0},
{Name: "expires", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "remain_downloads", Type: field.TypeInt, Nullable: true},
{Name: "price_points", Type: field.TypeInt, Default: 0},
{Name: "listed_publicly", Type: field.TypeBool, Default: false},
{Name: "props", Type: field.TypeJSON, Nullable: true},
{Name: "file_shares", Type: field.TypeInt, Nullable: true},
{Name: "user_shares", Type: field.TypeInt, Nullable: true},
}
// SharesTable holds the schema information for the "shares" table.
SharesTable = &schema.Table{
Name: "shares",
Columns: SharesColumns,
PrimaryKey: []*schema.Column{SharesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "shares_files_shares",
Columns: []*schema.Column{SharesColumns[12]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "shares_users_shares",
Columns: []*schema.Column{SharesColumns[13]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// SharePurchasesColumns holds the columns for the "share_purchases" table.
SharePurchasesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "points", Type: field.TypeInt},
{Name: "ticket", Type: field.TypeString, Unique: true},
{Name: "share_id", Type: field.TypeInt},
{Name: "buyer_id", Type: field.TypeInt},
}
// SharePurchasesTable holds the schema information for the "share_purchases" table.
SharePurchasesTable = &schema.Table{
Name: "share_purchases",
Columns: SharePurchasesColumns,
PrimaryKey: []*schema.Column{SharePurchasesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "share_purchases_shares_purchases",
Columns: []*schema.Column{SharePurchasesColumns[6]},
RefColumns: []*schema.Column{SharesColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "share_purchases_users_share_purchases",
Columns: []*schema.Column{SharePurchasesColumns[7]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "sharepurchase_share_id_buyer_id",
Unique: true,
Columns: []*schema.Column{SharePurchasesColumns[6], SharePurchasesColumns[7]},
},
},
}
// SkusColumns holds the columns for the "skus" table.
SkusColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "type", Type: field.TypeEnum, Enums: []string{"storage", "group"}},
{Name: "amount", Type: field.TypeInt64},
{Name: "duration", Type: field.TypeInt64, Nullable: true},
{Name: "price", Type: field.TypeInt64, Nullable: true},
{Name: "points", Type: field.TypeInt64, Nullable: true},
{Name: "label", Type: field.TypeString, Nullable: true},
{Name: "des", Type: field.TypeString, Nullable: true},
{Name: "enabled", Type: field.TypeBool, Default: true},
{Name: "weight", Type: field.TypeInt, Default: 0},
}
// SkusTable holds the schema information for the "skus" table.
SkusTable = &schema.Table{
Name: "skus",
Columns: SkusColumns,
PrimaryKey: []*schema.Column{SkusColumns[0]},
}
// SSOBindingsColumns holds the columns for the "sso_bindings" table.
SSOBindingsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "provider", Type: field.TypeString, Size: 32},
{Name: "subject", Type: field.TypeString, Size: 128},
{Name: "user_id", Type: field.TypeInt},
}
// SSOBindingsTable holds the schema information for the "sso_bindings" table.
SSOBindingsTable = &schema.Table{
Name: "sso_bindings",
Columns: SSOBindingsColumns,
PrimaryKey: []*schema.Column{SSOBindingsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "sso_bindings_users_sso_bindings",
Columns: []*schema.Column{SSOBindingsColumns[6]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "ssobinding_provider_subject",
Unique: true,
Columns: []*schema.Column{SSOBindingsColumns[4], SSOBindingsColumns[5]},
},
{
Name: "ssobinding_user_id_provider",
Unique: true,
Columns: []*schema.Column{SSOBindingsColumns[6], SSOBindingsColumns[4]},
},
},
}
// StoragePoliciesColumns holds the columns for the "storage_policies" table.
StoragePoliciesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "name", Type: field.TypeString},
{Name: "type", Type: field.TypeString},
{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "suspended"}, Default: "active"},
{Name: "server", Type: field.TypeString, Nullable: true},
{Name: "bucket_name", Type: field.TypeString, Nullable: true},
{Name: "is_private", Type: field.TypeBool, Nullable: true},
{Name: "access_key", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "secret_key", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "max_size", Type: field.TypeInt64, Nullable: true},
{Name: "dir_name_rule", Type: field.TypeString, Nullable: true},
{Name: "file_name_rule", Type: field.TypeString, Nullable: true},
{Name: "settings", Type: field.TypeJSON, Nullable: true},
{Name: "node_id", Type: field.TypeInt, Nullable: true},
}
// StoragePoliciesTable holds the schema information for the "storage_policies" table.
StoragePoliciesTable = &schema.Table{
Name: "storage_policies",
Columns: StoragePoliciesColumns,
PrimaryKey: []*schema.Column{StoragePoliciesColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "storage_policies_nodes_storage_policy",
Columns: []*schema.Column{StoragePoliciesColumns[16]},
RefColumns: []*schema.Column{NodesColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// TasksColumns holds the columns for the "tasks" table.
TasksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "type", Type: field.TypeString},
{Name: "status", Type: field.TypeEnum, Enums: []string{"queued", "processing", "suspending", "error", "canceled", "completed"}, Default: "queued"},
{Name: "public_state", Type: field.TypeJSON},
{Name: "private_state", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "correlation_id", Type: field.TypeUUID, Nullable: true},
{Name: "creator_ip", Type: field.TypeString, Nullable: true, Size: 45},
{Name: "hidden", Type: field.TypeBool, Default: false},
{Name: "user_tasks", Type: field.TypeInt, 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_users_tasks",
Columns: []*schema.Column{TasksColumns[11]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.SetNull,
},
},
}
// UsersColumns holds the columns for the "users" table.
UsersColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "email", Type: field.TypeString, Unique: true, Size: 100},
{Name: "nick", Type: field.TypeString, Size: 100},
{Name: "password", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeEnum, Enums: []string{"active", "inactive", "manual_banned", "sys_banned"}, Default: "active"},
{Name: "ban_expires", Type: field.TypeTime, Nullable: true},
{Name: "ban_reason", Type: field.TypeString, Nullable: true, Size: 2147483647},
{Name: "last_login", Type: field.TypeTime, Nullable: true},
{Name: "storage", Type: field.TypeInt64, Default: 0},
{Name: "credits", Type: field.TypeInt64, Default: 0},
{Name: "two_factor_secret", Type: field.TypeString, Nullable: true},
{Name: "vault_password", Type: field.TypeString, Nullable: true},
{Name: "vault_folder", Type: field.TypeInt, Nullable: true, Default: 0},
{Name: "two_factor_backup_codes", Type: field.TypeJSON, Nullable: true},
{Name: "avatar", Type: field.TypeString, Nullable: true},
{Name: "settings", Type: field.TypeJSON, Nullable: true},
{Name: "group_users", Type: field.TypeInt},
}
// UsersTable holds the schema information for the "users" table.
UsersTable = &schema.Table{
Name: "users",
Columns: UsersColumns,
PrimaryKey: []*schema.Column{UsersColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "users_groups_users",
Columns: []*schema.Column{UsersColumns[19]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.NoAction,
},
},
}
// UserGrantsColumns holds the columns for the "user_grants" table.
UserGrantsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
{Name: "type", Type: field.TypeEnum, Enums: []string{"storage", "group"}},
{Name: "amount", Type: field.TypeInt64},
{Name: "prev_group_id", Type: field.TypeInt, Nullable: true},
{Name: "expires_at", Type: field.TypeTime, Nullable: true},
{Name: "user_id", Type: field.TypeInt},
}
// UserGrantsTable holds the schema information for the "user_grants" table.
UserGrantsTable = &schema.Table{
Name: "user_grants",
Columns: UserGrantsColumns,
PrimaryKey: []*schema.Column{UserGrantsColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "user_grants_users_grants",
Columns: []*schema.Column{UserGrantsColumns[8]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "usergrant_user_id_type",
Unique: false,
Columns: []*schema.Column{UserGrantsColumns[8], UserGrantsColumns[4]},
},
{
Name: "usergrant_expires_at",
Unique: false,
Columns: []*schema.Column{UserGrantsColumns[7]},
},
},
}
// FileEntitiesColumns holds the columns for the "file_entities" table.
FileEntitiesColumns = []*schema.Column{
{Name: "file_id", Type: field.TypeInt},
{Name: "entity_id", Type: field.TypeInt},
}
// FileEntitiesTable holds the schema information for the "file_entities" table.
FileEntitiesTable = &schema.Table{
Name: "file_entities",
Columns: FileEntitiesColumns,
PrimaryKey: []*schema.Column{FileEntitiesColumns[0], FileEntitiesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "file_entities_file_id",
Columns: []*schema.Column{FileEntitiesColumns[0]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "file_entities_entity_id",
Columns: []*schema.Column{FileEntitiesColumns[1]},
RefColumns: []*schema.Column{EntitiesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// GroupAllowedPoliciesColumns holds the columns for the "group_allowed_policies" table.
GroupAllowedPoliciesColumns = []*schema.Column{
{Name: "group_id", Type: field.TypeInt},
{Name: "storage_policy_id", Type: field.TypeInt},
}
// GroupAllowedPoliciesTable holds the schema information for the "group_allowed_policies" table.
GroupAllowedPoliciesTable = &schema.Table{
Name: "group_allowed_policies",
Columns: GroupAllowedPoliciesColumns,
PrimaryKey: []*schema.Column{GroupAllowedPoliciesColumns[0], GroupAllowedPoliciesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "group_allowed_policies_group_id",
Columns: []*schema.Column{GroupAllowedPoliciesColumns[0]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "group_allowed_policies_storage_policy_id",
Columns: []*schema.Column{GroupAllowedPoliciesColumns[1]},
RefColumns: []*schema.Column{StoragePoliciesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// ShareFilesColumns holds the columns for the "share_files" table.
ShareFilesColumns = []*schema.Column{
{Name: "share_id", Type: field.TypeInt},
{Name: "file_id", Type: field.TypeInt},
}
// ShareFilesTable holds the schema information for the "share_files" table.
ShareFilesTable = &schema.Table{
Name: "share_files",
Columns: ShareFilesColumns,
PrimaryKey: []*schema.Column{ShareFilesColumns[0], ShareFilesColumns[1]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "share_files_share_id",
Columns: []*schema.Column{ShareFilesColumns[0]},
RefColumns: []*schema.Column{SharesColumns[0]},
OnDelete: schema.Cascade,
},
{
Symbol: "share_files_file_id",
Columns: []*schema.Column{ShareFilesColumns[1]},
RefColumns: []*schema.Column{FilesColumns[0]},
OnDelete: schema.Cascade,
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AbuseReportsTable,
ACLEntriesTable,
ActivityEventsTable,
CreditTxnsTable,
DavAccountsTable,
DirectLinksTable,
EntitiesTable,
FilesTable,
FsEventsTable,
GiftCodesTable,
GroupsTable,
InvitationCodesTable,
MetadataTable,
NodesTable,
OauthClientsTable,
OauthGrantsTable,
PasskeysTable,
SettingsTable,
SharesTable,
SharePurchasesTable,
SkusTable,
SSOBindingsTable,
StoragePoliciesTable,
TasksTable,
UsersTable,
UserGrantsTable,
FileEntitiesTable,
GroupAllowedPoliciesTable,
ShareFilesTable,
}
)
func init() {
ACLEntriesTable.ForeignKeys[0].RefTable = FilesTable
CreditTxnsTable.ForeignKeys[0].RefTable = UsersTable
DavAccountsTable.ForeignKeys[0].RefTable = UsersTable
DirectLinksTable.ForeignKeys[0].RefTable = FilesTable
EntitiesTable.ForeignKeys[0].RefTable = StoragePoliciesTable
EntitiesTable.ForeignKeys[1].RefTable = UsersTable
FilesTable.ForeignKeys[0].RefTable = FilesTable
FilesTable.ForeignKeys[1].RefTable = StoragePoliciesTable
FilesTable.ForeignKeys[2].RefTable = UsersTable
FsEventsTable.ForeignKeys[0].RefTable = UsersTable
GiftCodesTable.ForeignKeys[0].RefTable = UsersTable
GroupsTable.ForeignKeys[0].RefTable = StoragePoliciesTable
MetadataTable.ForeignKeys[0].RefTable = FilesTable
OauthGrantsTable.ForeignKeys[0].RefTable = OauthClientsTable
OauthGrantsTable.ForeignKeys[1].RefTable = UsersTable
PasskeysTable.ForeignKeys[0].RefTable = UsersTable
SharesTable.ForeignKeys[0].RefTable = FilesTable
SharesTable.ForeignKeys[1].RefTable = UsersTable
SharePurchasesTable.ForeignKeys[0].RefTable = SharesTable
SharePurchasesTable.ForeignKeys[1].RefTable = UsersTable
SSOBindingsTable.ForeignKeys[0].RefTable = UsersTable
StoragePoliciesTable.ForeignKeys[0].RefTable = NodesTable
TasksTable.ForeignKeys[0].RefTable = UsersTable
UsersTable.ForeignKeys[0].RefTable = GroupsTable
UserGrantsTable.ForeignKeys[0].RefTable = UsersTable
FileEntitiesTable.ForeignKeys[0].RefTable = FilesTable
FileEntitiesTable.ForeignKeys[1].RefTable = EntitiesTable
GroupAllowedPoliciesTable.ForeignKeys[0].RefTable = GroupsTable
GroupAllowedPoliciesTable.ForeignKeys[1].RefTable = StoragePoliciesTable
ShareFilesTable.ForeignKeys[0].RefTable = SharesTable
ShareFilesTable.ForeignKeys[1].RefTable = FilesTable
}