You are here

function og_schema in Organic groups 6

Same name and namespace in other branches
  1. 6.2 og.install \og_schema()
  2. 7.2 og.install \og_schema()
  3. 7 og.install \og_schema()

Definition of hook_schema();

File

./og.install, line 11

Code

function og_schema() {
  $schema = array();
  $schema['og'] = array(
    'description' => t('Stores information about each group.'),
    'fields' => array(
      'nid' => array(
        'description' => t("The group's {node}.nid."),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'og_selective' => array(
        'description' => t('Determines how subscription requests are handled (open, moderated, invite only, closed).'),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
        'default' => 0,
      ),
      'og_description' => array(
        'description' => t('Group description. Shows up by default on group directory.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'og_theme' => array(
        'description' => t('The group specific theme (if any). See {system}.name.'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'og_register' => array(
        'description' => t('Should users be able to join this group from registration form.'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'og_directory' => array(
        'description' => t('Should this group appear in the groups directory.'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'og_language' => array(
        'description' => t('Group specific language. See {languages}.language.'),
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'og_private' => array(
        'description' => t('Is group home page private or public.'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
  );
  $schema['og_uid'] = array(
    'description' => t('Group memberships'),
    'fields' => array(
      'nid' => array(
        'description' => t("Group's {node}.nid."),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'og_role' => array(
        'description' => t('Not currently used.'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'is_active' => array(
        'description' => t('Is this membership active or pending?'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'is_admin' => array(
        'description' => t('Is this user a group administrator?'),
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'uid' => array(
        'description' => t('The user for this membership. See {users}.uid.'),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'created' => array(
        'description' => t('Time when this membership was created.'),
        'type' => 'int',
        'size' => 'normal',
        'not null' => FALSE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => t('Time when this membership was last changed.'),
        'type' => 'int',
        'size' => 'normal',
        'not null' => FALSE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'uid',
    ),
  );
  $schema['og_ancestry'] = array(
    'description' => '',
    'fields' => array(
      'nid' => array(
        'description' => t("The post's {node}.nid."),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'group_nid' => array(
        'description' => t("The group's {node}.nid."),
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'is_public' => array(
        'description' => t('Is this a public or private post? This value is always the same across all groups for a given post.'),
        'type' => 'int',
        'size' => 'tiny',
        'default' => 1,
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'nid' => array(
        'nid',
      ),
      'group_nid' => array(
        'group_nid',
      ),
    ),
  );
  return $schema;
}