| 1 |
<?php
|
| 2 |
|
| 3 |
function marc_schema() {
|
| 4 |
|
| 5 |
$schema['marc_records'] = array(
|
| 6 |
'description' => t('Table that holds marc record data'),
|
| 7 |
'fields' => array(
|
| 8 |
'mid' => array(
|
| 9 |
'description' => t('The primary identifier for a marc record'),
|
| 10 |
'type' => 'serial',
|
| 11 |
'unsigned' => TRUE,
|
| 12 |
'not null' => TRUE),
|
| 13 |
'changed' => array(
|
| 14 |
'description' => t('The Unix timestamp when the record was last changed.'),
|
| 15 |
'type' => 'int',
|
| 16 |
'not null' => TRUE,
|
| 17 |
'default' => 0),
|
| 18 |
'nid' => array(
|
| 19 |
'description' => t('The node identifier.'),
|
| 20 |
'type' => 'int',
|
| 21 |
'not null' => TRUE,
|
| 22 |
'default' => 0),
|
| 23 |
'content_type' => array(
|
| 24 |
'description' => t('The {node_type}.type of this node.'),
|
| 25 |
'type' => 'varchar',
|
| 26 |
'length' => 32,
|
| 27 |
'not null' => TRUE,
|
| 28 |
'default' => ''),
|
| 29 |
'iid' => array(
|
| 30 |
'description' => t('The marc import identifier'),
|
| 31 |
'type' => 'int',
|
| 32 |
'not null' => TRUE,
|
| 33 |
'default' => 0),
|
| 34 |
'status' => array(
|
| 35 |
'description' => t('Status within import progression: 0 = not imported, 1 = node created, 2 = marc array serialized.'),
|
| 36 |
'type' => 'int',
|
| 37 |
'not null' => TRUE,
|
| 38 |
'default' => 0),
|
| 39 |
'record' => array(
|
| 40 |
'description' => t('The MARC record data'),
|
| 41 |
'type' => 'text',
|
| 42 |
'not null' => TRUE,
|
| 43 |
'size' => 'big'),
|
| 44 |
),
|
| 45 |
'indexes' => array(
|
| 46 |
'nid' => array('nid'),
|
| 47 |
),
|
| 48 |
'primary key' => array('mid'),
|
| 49 |
);
|
| 50 |
|
| 51 |
$schema['marc_import'] = array(
|
| 52 |
'description' => t('Table that holds marc import history'),
|
| 53 |
'fields' => array(
|
| 54 |
'miid' => array(
|
| 55 |
'description' => t('The primary identifier for a marc record'),
|
| 56 |
'type' => 'serial',
|
| 57 |
'unsigned' => TRUE,
|
| 58 |
'not null' => TRUE),
|
| 59 |
'timestamp' => array(
|
| 60 |
'description' => t('The Unix timestamp when the import started.'),
|
| 61 |
'type' => 'int',
|
| 62 |
'not null' => TRUE,
|
| 63 |
'default' => 0),
|
| 64 |
'filename' => array(
|
| 65 |
'description' => t('The MARC field getting mapped.'),
|
| 66 |
'type' => 'varchar',
|
| 67 |
'length' => 128,
|
| 68 |
'not null' => TRUE,
|
| 69 |
'default' => ''),
|
| 70 |
'content_type' => array(
|
| 71 |
'description' => t('The {node_type}.type of this node.'),
|
| 72 |
'type' => 'varchar',
|
| 73 |
'length' => 32,
|
| 74 |
'not null' => TRUE,
|
| 75 |
'default' => ''),
|
| 76 |
'records' => array(
|
| 77 |
'description' => t('Total records in file.'),
|
| 78 |
'type' => 'int',
|
| 79 |
'not null' => TRUE,
|
| 80 |
'default' => 0),
|
| 81 |
'processed' => array(
|
| 82 |
'description' => t('Total records processed.'),
|
| 83 |
'type' => 'int',
|
| 84 |
'not null' => TRUE,
|
| 85 |
'default' => 0),
|
| 86 |
'nid' => array(
|
| 87 |
'description' => t('The node identifier.'),
|
| 88 |
'type' => 'int',
|
| 89 |
'not null' => TRUE,
|
| 90 |
'default' => 0),
|
| 91 |
),
|
| 92 |
'primary key' => array('miid'),
|
| 93 |
);
|
| 94 |
return $schema;
|
| 95 |
}
|
| 96 |
|
| 97 |
function marc_install() {
|
| 98 |
drupal_install_schema('marc');
|
| 99 |
}
|
| 100 |
|
| 101 |
/**
|
| 102 |
* Implementation of hook_uninstall().
|
| 103 |
*/
|
| 104 |
function marc_uninstall() {
|
| 105 |
// Remove tables.
|
| 106 |
drupal_uninstall_schema('marc');
|
| 107 |
}
|