// Code generated by ent, DO NOT EDIT.

package migrate

import (
	"entgo.io/ent/dialect/sql/schema"
	"entgo.io/ent/schema/field"
)

var (
	// 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: "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[10]},
				RefColumns: []*schema.Column{StoragePoliciesColumns[0]},
				OnDelete:   schema.NoAction,
			},
			{
				Symbol:     "entities_users_entities",
				Columns:    []*schema.Column{EntitiesColumns[11]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// 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_size",
				Unique:  false,
				Columns: []*schema.Column{FilesColumns[9], FilesColumns[3], FilesColumns[5]},
			},
		},
	}
	// 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,
			},
		},
	}
	// 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]},
	}
	// 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: "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[10]},
				RefColumns: []*schema.Column{FilesColumns[0]},
				OnDelete:   schema.SetNull,
			},
			{
				Symbol:     "shares_users_shares",
				Columns:    []*schema.Column{SharesColumns[11]},
				RefColumns: []*schema.Column{UsersColumns[0]},
				OnDelete:   schema.SetNull,
			},
		},
	}
	// 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: "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[15]},
				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: "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[9]},
				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: "storage", Type: field.TypeInt64, Default: 0},
		{Name: "two_factor_secret", Type: field.TypeString, 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[12]},
				RefColumns: []*schema.Column{GroupsColumns[0]},
				OnDelete:   schema.NoAction,
			},
		},
	}
	// 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,
			},
		},
	}
	// Tables holds all the tables in the schema.
	Tables = []*schema.Table{
		DavAccountsTable,
		DirectLinksTable,
		EntitiesTable,
		FilesTable,
		GroupsTable,
		MetadataTable,
		NodesTable,
		PasskeysTable,
		SettingsTable,
		SharesTable,
		StoragePoliciesTable,
		TasksTable,
		UsersTable,
		FileEntitiesTable,
	}
)

func init() {
	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
	GroupsTable.ForeignKeys[0].RefTable = StoragePoliciesTable
	MetadataTable.ForeignKeys[0].RefTable = FilesTable
	PasskeysTable.ForeignKeys[0].RefTable = UsersTable
	SharesTable.ForeignKeys[0].RefTable = FilesTable
	SharesTable.ForeignKeys[1].RefTable = UsersTable
	StoragePoliciesTable.ForeignKeys[0].RefTable = NodesTable
	TasksTable.ForeignKeys[0].RefTable = UsersTable
	UsersTable.ForeignKeys[0].RefTable = GroupsTable
	FileEntitiesTable.ForeignKeys[0].RefTable = FilesTable
	FileEntitiesTable.ForeignKeys[1].RefTable = EntitiesTable
}
