You are here

function og_ancestry_dedupe in Organic groups 6.2

2 calls to og_ancestry_dedupe()
og_access_update_6201 in modules/og_access/og_access.install
og_update_6203 in ./og.install

File

./og.install, line 222

Code

function og_ancestry_dedupe(&$ret) {
  $schema['og_ancestry_new'] = array(
    'description' => '',
    'fields' => array(
      'nid' => array(
        'description' => "The post's {node}.nid.",
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
      'group_nid' => array(
        'description' => "The group's {node}.nid.",
        'type' => 'int',
        'size' => 'normal',
        'not null' => TRUE,
      ),
    ),
  );
  db_create_table($ret, 'og_ancestry_new', $schema['og_ancestry_new']);
  $ret[] = update_sql("INSERT INTO {og_ancestry_new} SELECT DISTINCT * FROM {og_ancestry}");
  db_drop_table($ret, 'og_ancestry');
  db_rename_table($ret, 'og_ancestry_new', 'og_ancestry');
  db_add_primary_key($ret, 'og_ancestry', array(
    'nid',
    'group_nid',
  ));
}