schema.inc.php.svn-base
来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· SVN-BASE 代码 · 共 1,058 行 · 第 1/3 页
SVN-BASE
1,058 行
$this->defineForeignKey('document_role_allocations','permission_descriptor_id','permission_descriptors','id'); $this->defineForeignKey('document_searchable_text','document_id','documents','id'); $this->defineForeignKey('document_subscriptions','user_id','users','id'); $this->defineForeignKey('document_subscriptions','document_id','documents','id'); $this->defineForeignKey('document_tags','document_id','documents','id'); $this->defineForeignKey('document_tags','tag_id','tag_words','id'); $this->defineForeignKey('document_text','document_id','documents','id'); $this->defineForeignKey('document_transaction_text','document_id','documents','id'); $this->defineForeignKey('document_type_fields_link','document_type_id', 'document_types_lookup','id'); $this->defineForeignKey('document_type_fields_link','field_id','document_fields','id'); $this->defineForeignKey('document_type_fieldsets_link','document_type_id', 'document_types_lookup','id'); $this->defineForeignKey('document_type_fieldsets_link','fieldset_id','fieldsets','id'); $this->defineForeignKey('documents','creator_id','users','id', 'SET NULL', 'SET NULL'); $this->defineForeignKey('documents','folder_id','folders','id'); $this->defineForeignKey('documents','checked_out_user_id','users','id', 'SET NULL', 'SET NULL'); $this->defineForeignKey('documents','status_id','status_lookup','id'); $this->defineForeignKey('documents','permission_object_id','permission_objects','id'); $this->defineForeignKey('documents','permission_lookup_id','permission_lookups','id'); $this->defineForeignKey('documents','modified_user_id','users','id', 'SET NULL', 'SET NULL'); $this->defineForeignKey('documents','metadata_version_id','document_metadata_version','id'); $this->defineForeignKey('download_files','document_id','documents','id'); $this->defineForeignKey('field_behaviour_options','behaviour_id','field_behaviours','id'); $this->defineForeignKey('field_behaviour_options','field_id','document_fields','id'); $this->defineForeignKey('field_behaviour_options','instance_id','field_value_instances','id'); $this->defineForeignKey('field_behaviours','field_id','document_fields','id'); $this->defineForeignKey('field_orders','child_field_id','document_fields','id'); $this->defineForeignKey('field_orders','parent_field_id','document_fields','id'); $this->defineForeignKey('field_orders','fieldset_id','fieldsets','id'); $this->defineForeignKey('field_value_instances','field_value_id','metadata_lookup','id'); // it is so.. strange ;) $this->defineForeignKey('field_value_instances','behaviour_id','field_behaviours','id'); $this->defineForeignKey('field_value_instances','field_id','document_fields','id'); $this->defineForeignKey('fieldsets','master_field','document_fields','id'); $this->defineForeignKey('folder_descendants','parent_id','folders','id'); $this->defineForeignKey('folder_descendants','folder_id','folders','id'); $this->defineForeignKey('folder_doctypes_link','folder_id','folders','id'); $this->defineForeignKey('folder_doctypes_link','document_type_id','document_types_lookup','id'); $this->defineForeignKey('folder_searchable_text','folder_id','folders','id'); $this->defineForeignKey('folder_subscriptions','user_id','users','id'); $this->defineForeignKey('folder_subscriptions','folder_id','folders','id'); $this->defineForeignKey('folder_workflow_map','folder_id', 'folders','id'); $this->defineForeignKey('folder_workflow_map','workflow_id', 'workflows','id'); $this->defineForeignKey('folders','creator_id','users','id'); $this->defineForeignKey('folders','permission_object_id','permission_objects','id'); $this->defineForeignKey('folders','permission_lookup_id','permission_lookups','id'); $this->defineForeignKey('folders','parent_id','folders','id'); $this->defineForeignKey('folders_users_roles_link','user_id','users','id'); $this->defineForeignKey('folders_users_roles_link','document_id','documents','id'); $this->defineForeignKey('groups_groups_link','parent_group_id','groups_lookup','id'); $this->defineForeignKey('groups_groups_link','member_group_id','groups_lookup','id'); $this->defineForeignKey('groups_lookup','unit_id', 'units_lookup','id'); $this->defineForeignKey('index_files','document_id','documents','id'); $this->defineForeignKey('index_files','user_id','users','id'); $this->defineForeignKey('metadata_lookup','document_field_id','document_fields','id'); $this->defineForeignKey('metadata_lookup_tree','document_field_id', 'document_fields','id'); $this->defineForeignKey('mime_types','mime_document_id','mime_documents','id', 'set null', 'set null'); $this->defineForeignKey('mime_types','extractor_id','mime_extractors','id', 'set null', 'set null'); $this->defineForeignKey('mime_document_mapping','mime_type_id','mime_types','id'); $this->defineForeignKey('mime_document_mapping','mime_document_id','mime_documents','id'); $this->defineForeignKey('news','image_mime_type_id','mime_types','id'); $this->defineForeignKey('notifications','user_id', 'users','id'); $this->defineForeignKey('permission_assignments','permission_id', 'permissions','id'); $this->defineForeignKey('permission_assignments','permission_object_id','permission_objects','id'); // duplicate $this->defineForeignKey('permission_assignments','permission_descriptor_id','permission_descriptors','id'); $this->defineForeignKey('permission_descriptor_groups','descriptor_id','permission_descriptors','id'); $this->defineForeignKey('permission_descriptor_groups','group_id','groups_lookup','id'); $this->defineForeignKey('permission_descriptor_roles','descriptor_id','permission_descriptors','id'); $this->defineForeignKey('permission_descriptor_roles','role_id','roles','id'); $this->defineForeignKey('permission_descriptor_users','descriptor_id','permission_descriptors','id'); $this->defineForeignKey('permission_descriptor_users','user_id','users','id'); $this->defineForeignKey('permission_dynamic_assignments','dynamic_condition_id','permission_dynamic_conditions','id'); $this->defineForeignKey('permission_dynamic_assignments','permission_id','permissions','id'); $this->defineForeignKey('permission_dynamic_conditions','permission_object_id','permission_objects','id'); $this->defineForeignKey('permission_dynamic_conditions','group_id','groups_lookup','id'); $this->defineForeignKey('permission_dynamic_conditions','condition_id','saved_searches','id'); $this->defineForeignKey('permission_lookup_assignments','permission_id','permissions','id'); $this->defineForeignKey('permission_lookup_assignments','permission_lookup_id','permission_lookups','id'); // duplicate $this->defineForeignKey('permission_lookup_assignments','permission_descriptor_id','permission_descriptors','id'); $this->defineForeignKey('plugin_rss','user_id','users','id'); $this->defineForeignKey('quicklinks','user_id','users','id'); $this->defineForeignKey('role_allocations','folder_id','folders','id'); $this->defineForeignKey('role_allocations','role_id', 'roles','id'); $this->defineForeignKey('role_allocations','permission_descriptor_id','permission_descriptors','id'); $this->defineForeignKey('saved_searches','user_id','users','id'); $this->defineForeignKey('search_document_user_link','document_id','documents','id'); $this->defineForeignKey('search_document_user_link','user_id','users','id'); $this->defineForeignKey('search_saved','user_id','users','id'); $this->defineForeignKey('search_saved_events','document_id','documents','id'); $this->defineForeignKey('time_period','time_unit_id','time_unit_lookup','id'); $this->defineForeignKey('type_workflow_map','document_type_id','document_types_lookup','id'); $this->defineForeignKey('type_workflow_map','workflow_id','workflows','id'); $this->defineForeignKey('units_lookup','folder_id','folders','id'); $this->defineForeignKey('units_organisations_link','unit_id','units_lookup','id'); $this->defineForeignKey('units_organisations_link','organisation_id','organisations_lookup','id'); $this->defineForeignKey('uploaded_files','userid','users','id'); $this->defineForeignKey('uploaded_files','document_id','documents','id'); $this->defineForeignKey('user_history','user_id','users','id'); $this->defineForeignKey('user_history_documents','document_id','documents','id'); $this->defineForeignKey('user_history_documents','user_id','users','id'); $this->defineForeignKey('user_history_folders','folder_id','folders','id'); $this->defineForeignKey('user_history_folders','user_id','users','id'); $this->defineForeignKey('users','authentication_source_id','authentication_sources','id'); $this->defineForeignKey('users_groups_link', 'user_id','users','id'); $this->defineForeignKey('users_groups_link', 'group_id','groups_lookup', 'id'); $this->defineForeignKey('workflow_documents','document_id', 'documents','id'); $this->defineForeignKey('workflow_documents','workflow_id', 'workflows','id'); $this->defineForeignKey('workflow_documents','state_id','workflow_states','id'); $this->defineForeignKey('workflow_state_actions','state_id','workflow_states','id'); $this->defineForeignKey('workflow_state_disabled_actions','state_id','workflow_states','id'); $this->defineForeignKey('workflow_state_permission_assignments','permission_id','permissions','id'); $this->defineForeignKey('workflow_state_permission_assignments','permission_descriptor_id','permission_descriptors','id'); $this->defineForeignKey('workflow_state_permission_assignments','workflow_state_id','workflow_states','id'); $this->defineForeignKey('workflow_state_transitions','state_id','workflow_states','id'); $this->defineForeignKey('workflow_state_transitions','transition_id','workflow_transitions','id'); $this->defineForeignKey('workflow_states','workflow_id', 'workflows','id'); $this->defineForeignKey('workflow_states','inform_descriptor_id', 'permission_descriptors','id'); $this->defineForeignKey('workflow_transitions','workflow_id','workflows','id'); $this->defineForeignKey('workflow_transitions','target_state_id','workflow_states','id'); $this->defineForeignKey('workflow_transitions','guard_permission_id','permissions','id'); $this->defineForeignKey('workflow_transitions','guard_condition_id','saved_searches','id'); $this->defineForeignKey('workflow_transitions','guard_group_id','groups_lookup','id'); $this->defineForeignKey('workflow_transitions','guard_role_id','roles','id'); $this->defineForeignKey('workflow_trigger_instances','workflow_transition_id','workflow_transitions','id'); $this->defineForeignKey('workflows','start_state_id','workflow_states','id'); } /** * Adds indexes that are not defined automatically via foreign key constraints and also adds criteria such as uniqueness. * */ private function defineOtherIndexes() { $this->indexes = array(); $this->defineIndex('active_sessions', 'session_id'); $this->defineIndex('authentication_sources','namespace'); $this->defineIndex('column_entries','view_namespace'); $this->defineIndex('comment_searchable_text', 'body', 'FULLTEXT'); $this->defineIndex('dashlet_disables','dashlet_namespace'); $this->defineIndex('document_content_version','storage_path'); $this->defineIndex('document_metadata_version','version_created'); $this->defineIndex('document_role_allocations', array('document_id', 'role_id')); $this->defineIndex('document_searchable_text','document_text', 'FULLTEXT'); $this->defineIndex('document_text','document_text', 'FULLTEXT'); $this->defineIndex('document_transaction_text','document_text', 'FULLTEXT'); $this->defineIndex('document_transaction_types_lookup','namespace', 'UNIQUE'); $this->defineIndex('document_transactions','session_id'); $this->defineIndex('document_transactions','user_id'); $this->defineIndex('document_transactions','document_id'); $this->defineIndex('document_types_lookup','name'); $this->defineIndex('documents','created'); $this->defineIndex('documents','modified'); $this->defineIndex('documents','full_path','','(255)'); $this->defineIndex('documents','immutable'); $this->defineIndex('documents','checkedout'); $this->defineIndex('document_content_version','filename','','(255)'); $this->defineIndex('document_content_version','size'); $this->defineIndex('document_transactions',array('datetime','transaction_namespace')); $this->defineIndex('field_behaviour_options',array('behaviour_id','field_id')); $this->defineIndex('field_behaviours','name'); $this->defineIndex('fieldsets','is_generic'); $this->defineIndex('fieldsets','is_complete'); $this->defineIndex('fieldsets','is_system'); $this->defineIndex('field_orders','child_field_id', 'UNIQUE'); $this->defineIndex('folder_searchable_text','folder_text' ,'FULLTEXT'); $this->defineIndex('folder_transactions','folder_id'); $this->defineIndex('folder_transactions','session_id'); $this->defineIndex('folders', array('parent_id','name')); $this->defineIndex('groups_lookup','name', 'UNIQUE'); $this->defineIndex('groups_lookup', array('authentication_source_id','authentication_details_s1')); $this->defineIndex('interceptor_instances','interceptor_namespace'); $this->defineIndex('metadata_lookup','disabled'); $this->defineIndex('metadata_lookup_tree','metadata_lookup_tree_parent'); $this->defineIndex('mime_types','filetypes'); $this->defineIndex('mime_types','mimetypes'); $this->defineIndex('notifications','data_int_1'); $this->defineIndex('organisations_lookup','name', 'UNIQUE'); $this->defineIndex('permission_assignments', array('permission_object_id','permission_id'), 'UNIQUE'); $this->defineIndex('permission_descriptor_groups','group_id'); $this->defineIndex('permission_descriptor_roles','role_id'); $this->defineIndex('permission_descriptor_users','user_id'); $this->defineIndex('permission_descriptors','descriptor','UNIQUE'); $this->defineIndex('permission_lookup_assignments', array('permission_lookup_id', 'permission_id'), 'UNIQUE'); $this->defineIndex('permissions','name', 'UNIQUE'); $this->defineIndex('plugins','namespace','UNIQUE'); $this->defineIndex('plugins','disabled'); $this->defineIndex('plugin_helper','namespace'); $this->defineIndex('plugin_helper','plugin'); $this->defineIndex('plugin_helper','classtype'); $this->defineIndex('quicklinks','target_id'); $this->defineIndex('roles','name','UNIQUE'); $this->defineIndex('saved_searches','namespace','UNIQUE'); $this->defineIndex('scheduler_tasks','task', 'UNIQUE'); $this->defineIndex('system_settings','name', 'UNIQUE'); $this->defineIndex('units_lookup','name' ,'UNIQUE'); $this->defineIndex('units_lookup','folder_id' ,'UNIQUE'); $this->defineIndex('upgrades','descriptor'); $this->defineIndex('upgrades','parent'); $this->defineIndex('user_history','action_namespace'); $this->defineIndex('user_history','datetime'); $this->defineIndex('user_history','session_id'); $this->defineIndex('user_history_documents', array('user_id','document_id')); $this->defineIndex('user_history_folders', array('user_id','folder_id')); $this->defineIndex('users','username' ,'UNIQUE'); $this->defineIndex('users','authentication_source_id'); $this->defineIndex('users','last_login'); $this->defineIndex('users','disabled'); $this->defineIndex('workflow_states','name'); $this->defineIndex('workflow_states','inform_descriptor_id'); //? $this->defineIndex('workflow_transitions',array('workflow_id','name'), 'UNIQUE'); $this->defineIndex('workflow_transitions','name'); $this->defineIndex('workflow_transitions','guard_permission_id'); //? $this->defineIndex('workflow_trigger_instances','namespace'); $this->defineIndex('workflows','name', 'UNIQUE'); } private function definePrimaryKey($table, $primaryKey) { $definition = new stdClass(); $definition->table = $table; $definition->primaryKey = $primaryKey; $this->primaryKeys[] = $definition; } private function defineForeignKey($table, $field, $otherTable, $otherField, $onDelete='cascade', $onUpdate='cascade') { $definition = new stdClass(); $definition->table = $table; $definition->field = $field; $definition->otherTable = $otherTable; $definition->otherField = $otherField; $definition->onDelete = $onDelete; $definition->onUpdate = $onUpdate; $this->foreignKeys[] = $definition; } private function defineIndex($table, $fields, $type='', $extra='') { $definition = new stdClass(); $definition->table = $table; $definition->fields = $fields;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?