| 1 |
<?php
|
| 2 |
// $Id: $
|
| 3 |
|
| 4 |
function import_manager_install() {
|
| 5 |
drupal_install_schema('import_manager');
|
| 6 |
}
|
| 7 |
|
| 8 |
function import_manager_uninstall() {
|
| 9 |
drupal_uninstall_schema('import_manager');
|
| 10 |
}
|
| 11 |
|
| 12 |
function import_manager_schema() {
|
| 13 |
return array(
|
| 14 |
'import_manager' => array(
|
| 15 |
'fields' => array(
|
| 16 |
'callback' => array(
|
| 17 |
'type' => 'varchar',
|
| 18 |
'length' => 255,
|
| 19 |
'not null' => TRUE,
|
| 20 |
),
|
| 21 |
'last_run' => array(
|
| 22 |
'type' => 'int',
|
| 23 |
'not null' => TRUE,
|
| 24 |
),
|
| 25 |
),
|
| 26 |
'primary key' => array('callback'),
|
| 27 |
),
|
| 28 |
'import_manager_log' => array(
|
| 29 |
'fields' => array(
|
| 30 |
'import_id' => array(
|
| 31 |
'type' => 'serial',
|
| 32 |
'not null' => TRUE,
|
| 33 |
),
|
| 34 |
'callback' => array(
|
| 35 |
'type' => 'varchar',
|
| 36 |
'length' => 255,
|
| 37 |
'not null' => TRUE,
|
| 38 |
),
|
| 39 |
'time' => array(
|
| 40 |
'type' => 'int',
|
| 41 |
'not null' => TRUE,
|
| 42 |
'unsigned' => TRUE,
|
| 43 |
),
|
| 44 |
'duration' => array(
|
| 45 |
'type' => 'int',
|
| 46 |
'not null' => TRUE,
|
| 47 |
'unsigned' => TRUE,
|
| 48 |
),
|
| 49 |
),
|
| 50 |
'primary key' => array('import_id'),
|
| 51 |
'indexes' => array(
|
| 52 |
'callback_time' => array('callback', 'time'),
|
| 53 |
),
|
| 54 |
),
|
| 55 |
|
| 56 |
'import_manager_log_detail' => array(
|
| 57 |
'fields' => array(
|
| 58 |
'import_id' => array(
|
| 59 |
'type' => 'int',
|
| 60 |
'not null' => TRUE,
|
| 61 |
),
|
| 62 |
'message' => array(
|
| 63 |
'type' => 'text',
|
| 64 |
'size' => 'big',
|
| 65 |
'not null' => TRUE,
|
| 66 |
),
|
| 67 |
'timestamp' => array(
|
| 68 |
'type' => 'int',
|
| 69 |
'not null' => TRUE,
|
| 70 |
'default' => 0,
|
| 71 |
),
|
| 72 |
'variables' => array(
|
| 73 |
'type' => 'text',
|
| 74 |
'size' => 'big',
|
| 75 |
'not null' => TRUE,
|
| 76 |
),
|
| 77 |
),
|
| 78 |
),
|
| 79 |
|
| 80 |
);
|
| 81 |
}
|
| 82 |
|
| 83 |
function import_manager_update_6001() {
|
| 84 |
$table = array(
|
| 85 |
'fields' => array(
|
| 86 |
'callback' => array(
|
| 87 |
'type' => 'varchar',
|
| 88 |
'length' => 255,
|
| 89 |
'not null' => TRUE,
|
| 90 |
),
|
| 91 |
'time' => array(
|
| 92 |
'type' => 'int',
|
| 93 |
'not null' => TRUE,
|
| 94 |
'unsigned' => TRUE,
|
| 95 |
),
|
| 96 |
'duration' => array(
|
| 97 |
'type' => 'int',
|
| 98 |
'not null' => TRUE,
|
| 99 |
'unsigned' => TRUE,
|
| 100 |
),
|
| 101 |
),
|
| 102 |
'indexes' => array(
|
| 103 |
'callback_time' => array('callback', 'time'),
|
| 104 |
),
|
| 105 |
);
|
| 106 |
$return = array();
|
| 107 |
db_create_table($return, 'import_manager_log', $table);
|
| 108 |
return $return;
|
| 109 |
}
|
| 110 |
|
| 111 |
/**
|
| 112 |
* Create table for holding import log details, add primary key column to import manager log table.
|
| 113 |
*/
|
| 114 |
function import_manager_update_6002() {
|
| 115 |
$table = array(
|
| 116 |
'fields' => array(
|
| 117 |
'import_id' => array(
|
| 118 |
'type' => 'int',
|
| 119 |
'not null' => TRUE,
|
| 120 |
),
|
| 121 |
'message' => array(
|
| 122 |
'type' => 'text',
|
| 123 |
'size' => 'big',
|
| 124 |
'not null' => TRUE,
|
| 125 |
),
|
| 126 |
'timestamp' => array(
|
| 127 |
'type' => 'int',
|
| 128 |
'not null' => TRUE,
|
| 129 |
'default' => 0,
|
| 130 |
),
|
| 131 |
'variables' => array(
|
| 132 |
'type' => 'text',
|
| 133 |
'size' => 'big',
|
| 134 |
'not null' => TRUE,
|
| 135 |
),
|
| 136 |
),
|
| 137 |
);
|
| 138 |
$return = array();
|
| 139 |
db_create_table($return, 'import_manager_log_detail', $table);
|
| 140 |
db_add_field($return, 'import_manager_log', 'import_id', array('type' => 'serial', 'not null' => TRUE), array('primary key' => array('import_id')));
|
| 141 |
return $return;
|
| 142 |
}
|