| 1 |
<?php
|
| 2 |
// $Id: uc_po.install,v 1.1 2008/05/07 19:35:39 rszrama Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
*
|
| 7 |
* Provide functions to install and uninstall the purchase
|
| 8 |
* order module in the database
|
| 9 |
*/
|
| 10 |
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Implementation of hook_schema().
|
| 14 |
*/
|
| 15 |
function uc_po_schema() {
|
| 16 |
$schema['uc_payment_po'] = array(
|
| 17 |
'fields' => array(
|
| 18 |
'po_id' => array(
|
| 19 |
'type' => 'serial',
|
| 20 |
'unsigned' => TRUE,
|
| 21 |
'not null' => TRUE,
|
| 22 |
),
|
| 23 |
'order_id' => array(
|
| 24 |
'type' => 'int',
|
| 25 |
'unsigned' => TRUE,
|
| 26 |
'not null' => TRUE,
|
| 27 |
'default' => 0,
|
| 28 |
),
|
| 29 |
'po_number' => array(
|
| 30 |
'type' => 'varchar',
|
| 31 |
'length' => '255',
|
| 32 |
'not null' => TRUE,
|
| 33 |
'default' => '',
|
| 34 |
),
|
| 35 |
),
|
| 36 |
'primary key' => array('po_id'),
|
| 37 |
'indexes' => array(
|
| 38 |
'order_id' => array('order_id')),
|
| 39 |
);
|
| 40 |
|
| 41 |
return $schema;
|
| 42 |
}
|
| 43 |
|
| 44 |
/**
|
| 45 |
* Implementation of hook_install().
|
| 46 |
*/
|
| 47 |
function uc_po_install() {
|
| 48 |
drupal_install_schema('uc_po');
|
| 49 |
}
|
| 50 |
|
| 51 |
/**
|
| 52 |
* Implementation of hook_uninstall().
|
| 53 |
*/
|
| 54 |
function uc_po_uninstall() {
|
| 55 |
drupal_uninstall_schema('uc_po');
|
| 56 |
|
| 57 |
variable_del('uc_po_instructions');
|
| 58 |
variable_del('uc_po_roles');
|
| 59 |
}
|
| 60 |
|
| 61 |
/**
|
| 62 |
* Implementations of hook_update_N().
|
| 63 |
*/
|
| 64 |
function uc_po_update_6000() {
|
| 65 |
$ret = array();
|
| 66 |
|
| 67 |
db_drop_primary_key($ret, 'uc_payment_po');
|
| 68 |
db_change_field($ret, 'uc_payment_po', 'po_id', 'po_id', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('po_id')));
|
| 69 |
|
| 70 |
return $ret;
|
| 71 |
}
|
| 72 |
|