| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install()
|
| 6 |
*/
|
| 7 |
function asset_install() {
|
| 8 |
drupal_install_schema('asset');
|
| 9 |
drupal_set_message(t('Asset tables have been configured.'));
|
| 10 |
if (module_exists('content')) content_notify('install', 'asset');
|
| 11 |
}
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Implementation of hook_uninstall()
|
| 15 |
*/
|
| 16 |
function asset_uninstall() {
|
| 17 |
drupal_uninstall_schema('asset');
|
| 18 |
if (module_exists('content')) content_notify('uninstall', 'asset');
|
| 19 |
}
|
| 20 |
|
| 21 |
/**
|
| 22 |
* Implementation of hook_schema()
|
| 23 |
*/
|
| 24 |
function asset_schema() {
|
| 25 |
$schema = array();
|
| 26 |
|
| 27 |
$schema['asset'] = array(
|
| 28 |
'fields' => array(
|
| 29 |
'aid' => array('type' => 'serial', 'unsigned' => true, 'not null' => true),
|
| 30 |
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => true),
|
| 31 |
'dirname' => array('type' => 'varchar', 'length' => 128, 'not null' => true),
|
| 32 |
'extension' => array('type' => 'varchar', 'length' => 128, 'not null' => true),
|
| 33 |
'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => true),
|
| 34 |
'filesize' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 35 |
'uid' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 36 |
'status' => array('type' => 'int', 'size' => 'tiny', 'unsigned' => true, 'not null' => true),
|
| 37 |
'author' => array('type' => 'varchar', 'length' => 128, 'not null' => true),
|
| 38 |
'title' => array('type' => 'varchar', 'length' => 128, 'not null' => true),
|
| 39 |
'description' => array('type' => 'text', 'not null' => true),
|
| 40 |
),
|
| 41 |
'primary key' => array('aid'),
|
| 42 |
'indexes' => array(
|
| 43 |
'uid' => array('uid'),
|
| 44 |
),
|
| 45 |
);
|
| 46 |
|
| 47 |
$schema['asset_node'] = array(
|
| 48 |
'fields' => array(
|
| 49 |
'anid' => array('type' => 'serial', 'unsigned' => true, 'not null' => true),
|
| 50 |
'aid' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 51 |
'nid' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 52 |
'refs' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 53 |
),
|
| 54 |
'primary key' => array('anid'),
|
| 55 |
'unique keys' => array(
|
| 56 |
'aid' => array('aid', 'nid'),
|
| 57 |
),
|
| 58 |
'indexes' => array(
|
| 59 |
'nid' => array('nid'),
|
| 60 |
),
|
| 61 |
);
|
| 62 |
|
| 63 |
$schema['asset_role'] = array(
|
| 64 |
'fields' => array(
|
| 65 |
'arid' => array('type' => 'serial', 'unsigned' => true, 'not null' => true),
|
| 66 |
'aid' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 67 |
'rid' => array('type' => 'int', 'unsigned' => true, 'not null' => true),
|
| 68 |
'status' => array('type' => 'int', 'size' => 'tiny', 'unsigned' => true, 'not null' => true),
|
| 69 |
),
|
| 70 |
'primary key' => array('arid'),
|
| 71 |
'unique keys' => array(
|
| 72 |
'aid' => array('aid', 'rid'),
|
| 73 |
),
|
| 74 |
'indexes' => array(
|
| 75 |
'arid' => array('arid'),
|
| 76 |
),
|
| 77 |
);
|
| 78 |
|
| 79 |
return $schema;
|
| 80 |
}
|