| 1 |
<?php
|
| 2 |
// $Id: xbview.install,v 1.1.2.3 2007/05/02 14:33:10 profix898 Exp $
|
| 3 |
|
| 4 |
function xbview_schema() {
|
| 5 |
$schema = array();
|
| 6 |
$schema['xbookmark'] = array(
|
| 7 |
'fields' => array(
|
| 8 |
'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 9 |
'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 10 |
'href' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 11 |
'icon' => array('type' => 'text', 'not null' => TRUE, 'default' => ''),
|
| 12 |
'type' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 13 |
'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
|
| 14 |
),
|
| 15 |
'primary key' => array('id'),
|
| 16 |
'indexes' => array(
|
| 17 |
'parent' => array('parent')
|
| 18 |
)
|
| 19 |
);
|
| 20 |
|
| 21 |
return $schema;
|
| 22 |
}
|
| 23 |
|
| 24 |
function xbview_install() {
|
| 25 |
drupal_install_schema('xbview');
|
| 26 |
}
|
| 27 |
|
| 28 |
function xbview_uninstall() {
|
| 29 |
// Drop tables
|
| 30 |
drupal_uninstall_schema('xbview');
|
| 31 |
// Remove variables
|
| 32 |
db_query("DELETE FROM {variable} WHERE name LIKE 'xbview_%'");
|
| 33 |
cache_clear_all('variables', 'cache');
|
| 34 |
}
|
| 35 |
|
| 36 |
// Update from table-less version properly
|
| 37 |
function xbview_update_1() {
|
| 38 |
$ret = array();
|
| 39 |
|
| 40 |
$schema = array();
|
| 41 |
$schema['xbookmark'] = array(
|
| 42 |
'fields' => array(
|
| 43 |
'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
|
| 44 |
'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 45 |
'href' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 46 |
'icon' => array('type' => 'text', 'not null' => TRUE, 'default' => ''),
|
| 47 |
'type' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
|
| 48 |
'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0)
|
| 49 |
),
|
| 50 |
'primary key' => array('id'),
|
| 51 |
'indexes' => array(
|
| 52 |
'parent' => array('parent')
|
| 53 |
)
|
| 54 |
);
|
| 55 |
|
| 56 |
db_create_table($ret, 'xbookmark', $schema['xbookmark']);
|
| 57 |
|
| 58 |
return $ret;
|
| 59 |
}
|