bp_core_install_document()

Description

Source

File: bp-core/admin/bp-core-admin-schema.php

715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
function bp_core_install_document() {
    $sql             = array();
    $charset_collate = $GLOBALS['wpdb']->get_charset_collate();
    $bp_prefix       = bp_core_get_table_prefix();
 
    $sql[] = "CREATE TABLE {$bp_prefix}bp_document_folder (
       id bigint(20) NOT NULL AUTO_INCREMENT,
       blog_id bigint(20) NULL DEFAULT NULL,
       user_id bigint(20) NOT NULL,
       group_id bigint(20) NULL,
       parent bigint(20) NULL DEFAULT 0,
       title text NOT NULL,
       privacy varchar(50) NULL DEFAULT 'public',
       date_created datetime NULL DEFAULT '0000-00-00 00:00:00',
       date_modified datetime NULL DEFAULT '0000-00-00 00:00:00',
       PRIMARY KEY  (id)
   ) {$charset_collate};";
 
    $sql[] = "CREATE TABLE {$bp_prefix}bp_document_folder_meta (
                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
                folder_id bigint(20) NOT NULL,
                meta_key varchar(255) DEFAULT NULL,
                meta_value longtext DEFAULT NULL,
                KEY folder_id (folder_id),
                KEY meta_key (meta_key(191))
            ) {$charset_collate};";
 
 
    $sql[] = "CREATE TABLE {$bp_prefix}bp_document (
        id bigint(20) NOT NULL AUTO_INCREMENT ,
        blog_id bigint(20) NULL DEFAULT NULL,
        attachment_id bigint(20) NOT NULL ,
        user_id bigint(20) NOT NULL,
        title text,
        folder_id bigint(20),
        group_id bigint(20),
        activity_id bigint(20) NULL DEFAULT NULL ,
        privacy varchar(50) NULL DEFAULT 'public',
        menu_order bigint(20) NULL DEFAULT 0 ,
        date_created datetime DEFAULT '0000-00-00 00:00:00',
        date_modified datetime NULL DEFAULT '0000-00-00 00:00:00',
        PRIMARY KEY  (id),
        KEY attachment_id (attachment_id),
        KEY user_id (user_id),
        KEY folder_id (folder_id),
        KEY document_author_id (folder_id,user_id),
        KEY activity_id (activity_id)
    ) {$charset_collate};";
 
    $sql[] = "CREATE TABLE {$bp_prefix}bp_document_meta (
                id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
                document_id bigint(20) NOT NULL,
                meta_key varchar(255) DEFAULT NULL,
                meta_value longtext DEFAULT NULL,
                KEY document_id (document_id),
                KEY meta_key (meta_key(191))
            ) {$charset_collate};";
 
 
    dbDelta( $sql );
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.