pay_node.install in Pay 7
Same filename and directory in other branches
Install, update and uninstall functions for the Pay Node module.
File
modules/pay_node/pay_node.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Pay Node module.
*/
/**
* Implements 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',
),
),
);
}
/**
* Add a "method" column to the pay_form_node table.
*/
function pay_node_update_6001() {
$spec = array(
'type' => 'varchar',
'length' => 20,
);
db_add_field('pay_form_node', 'method', $spec);
db_update('pay_form_node')
->fields(array(
'method' => "create",
))
->execute();
return t('Added a "method" column to the pay_form_node table.');
}
/**
* 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('pay_transaction_node', $table);
return t('Added the pay_transaction_node table.');
}
/**
* 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() {
// TODO: review this, check NULL bit.
db_update('pay_form')
->fields(array(
'menu_path' => NULL,
))
->condition('menu_path', 'node/%/pay', 'LIKE')
->execute();
return t('Removed menu_path entries from pay_node forms.');
}
Functions
Name | Description |
---|---|
pay_node_schema | Implements hook_schema(). |
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. |