You are here

pay_node.install in Pay 6

Same filename and directory in other branches
  1. 7 modules/pay_node/pay_node.install

Install, update and uninstall functions for the Pay Node module.

File

modules/pay_node/pay_node.install
View source
<?php

// $Id$

/**
 * @file
 * Install, update and uninstall functions for the Pay Node module.
 */

/**
 * Implementation of hook_schema().
 */
function pay_node_schema() {
  return array(
    'pay_form_node' => array(
      'fields' => array(
        'pfid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
        'nid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
        'method' => array(
          'type' => 'varchar',
          'length' => 20,
        ),
      ),
      'primary key' => array(
        'pfid',
        'nid',
      ),
    ),
    'pay_transaction_node' => array(
      'fields' => array(
        'pxid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
        'nid' => array(
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
      ),
      'primary key' => array(
        'pxid',
        'nid',
      ),
    ),
  );
}

/**
 * Implementation of hook_install().
 */
function pay_node_install() {
  drupal_install_schema('pay_node');
}

/**
 * Implementation of hook_uninstall().
 */
function pay_node_uninstall() {
  drupal_uninstall_schema('pay_node');
}

/**
 * Add a "method" column to the pay_form_node table.
 */
function pay_node_update_6001() {
  $spec = array(
    'type' => 'varchar',
    'length' => 20,
  );
  db_add_field($ret, 'pay_form_node', 'method', $spec);
  $ret[] = update_sql("UPDATE {pay_form_node} SET method = 'create'");
  return $ret;
}

/**
 * Add a the pay_transaction_node table.
 */
function pay_node_update_6002() {
  $table = array(
    'fields' => array(
      'pxid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
    ),
    'primary key' => array(
      'pxid',
      'nid',
    ),
  );
  db_create_table($ret, 'pay_transaction_node', $table);
  return $ret;
}

/**
 * Remove menu_path entries from pay_node forms.  This was causing an incorrect
 * menu callback for node/X/pay URLS and prevented transactions from being
 * associated with nodes correctly.
 */
function pay_node_update_6003() {
  $ret[] = update_sql("UPDATE {pay_form} SET menu_path = NULL\n    WHERE menu_path LIKE 'node/%/pay'");
  return $ret;
}

Functions

Namesort descending Description
pay_node_install Implementation of hook_install().
pay_node_schema Implementation of hook_schema().
pay_node_uninstall Implementation of hook_uninstall().
pay_node_update_6001 Add a "method" column to the pay_form_node table.
pay_node_update_6002 Add a the pay_transaction_node table.
pay_node_update_6003 Remove menu_path entries from pay_node forms. This was causing an incorrect menu callback for node/X/pay URLS and prevented transactions from being associated with nodes correctly.