You are here

function anonymous_publishing_update_7002 in Anonymous Publishing 7

Changes to schemas.

Add field 'apid' to {anonymous_publishing} and make it primary. Add field 'cid' to {anonymous_publishing}. Add field 'rnid' to {anonymous_publishing_realname} and make it primary. Add field 'cid' to {anonymous_publishing_realname}. Change {anonymous_publishing_emails}.firstseen to type 'date'.

File

./anonymous_publishing.install, line 363
Install and uninstall hooks.

Code

function anonymous_publishing_update_7002() {
  $serial = array(
    'description' => 'primary key',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
  );
  $nid = array(
    'description' => '{node}.nid reference',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  );
  $cid = array(
    'description' => '{comment}.cid reference',
    'type' => 'int',
    'unsigned' => FALSE,
    'not null' => TRUE,
    'default' => 0,
  );
  $firstseen = array(
    'description' => 'First seen as an ISO formatted date',
    'type' => 'varchar',
    'mysql_type' => 'date',
    'pgsql_type' => 'date',
    'not null' => TRUE,
    'default' => '1970-01-01',
  );
  db_change_field('anonymous_publishing', 'nid', 'nid', $nid);
  db_drop_primary_key('anonymous_publishing');
  db_add_field('anonymous_publishing', 'apid', $serial, array(
    'primary key' => array(
      'apid',
    ),
  ));
  db_add_field('anonymous_publishing', 'cid', $cid);
  db_change_field('anonymous_publishing_realname', 'nid', 'nid', $nid);
  db_drop_primary_key('anonymous_publishing_realname');
  db_add_field('anonymous_publishing_realname', 'rnid', $serial, array(
    'primary key' => array(
      'rnid',
    ),
  ));
  db_add_field('anonymous_publishing_realname', 'cid', $cid);
  db_change_field('anonymous_publishing_emails', 'firstseen', 'firstseen', $firstseen);
}