| 1 |
<?php
|
| 2 |
// $Id: context_ui.install,v 1.3 2008/07/17 16:57:19 jmiccolis Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* Implementation of hook_install().
|
| 6 |
*/
|
| 7 |
function context_ui_install() {
|
| 8 |
drupal_install_schema('context_ui');
|
| 9 |
}
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implementation of hook_uninstall().
|
| 13 |
*/
|
| 14 |
function context_ui_uninstall() {
|
| 15 |
drupal_uninstall_schema('context_ui');
|
| 16 |
}
|
| 17 |
/**
|
| 18 |
* Implementation of hook_schema().
|
| 19 |
*/
|
| 20 |
function context_ui_schema() {
|
| 21 |
$schema['context_ui'] = array(
|
| 22 |
'description' => t('context_ui.'),
|
| 23 |
'fields' => array(
|
| 24 |
'cid' => array(
|
| 25 |
'description' => t('The primary identifier for a context.'),
|
| 26 |
'type' => 'serial',
|
| 27 |
'unsigned' => TRUE,
|
| 28 |
'not null' => TRUE,
|
| 29 |
),
|
| 30 |
'system' => array(
|
| 31 |
'description' => t('?'),
|
| 32 |
'type' => 'int',
|
| 33 |
'size' => 'tiny',
|
| 34 |
'unsigned' => TRUE,
|
| 35 |
'not null' => TRUE,
|
| 36 |
'default' => 0,
|
| 37 |
),
|
| 38 |
'status' => array(
|
| 39 |
'description' => t('?'),
|
| 40 |
'type' => 'int',
|
| 41 |
'size' => 'tiny',
|
| 42 |
'unsigned' => TRUE,
|
| 43 |
'not null' => TRUE,
|
| 44 |
'default' => 0,
|
| 45 |
),
|
| 46 |
'namespace' => array(
|
| 47 |
'description' => t('?'),
|
| 48 |
'type' => 'varchar',
|
| 49 |
'length' => 64,
|
| 50 |
'not null' => TRUE,
|
| 51 |
'default' => '',
|
| 52 |
),
|
| 53 |
'attribute' => array(
|
| 54 |
'description' => t('?'),
|
| 55 |
'type' => 'varchar',
|
| 56 |
'length' => 64,
|
| 57 |
'not null' => TRUE,
|
| 58 |
'default' => '',
|
| 59 |
),
|
| 60 |
'value' => array(
|
| 61 |
'description' => t('?'),
|
| 62 |
'type' => 'varchar',
|
| 63 |
'length' => 64,
|
| 64 |
'not null' => TRUE,
|
| 65 |
'default' => '',
|
| 66 |
),
|
| 67 |
),
|
| 68 |
'unique keys' => array(
|
| 69 |
'key1' => array('system', 'namespace', 'attribute', 'value'),
|
| 70 |
),
|
| 71 |
'primary key' => array('cid'),
|
| 72 |
);
|
| 73 |
|
| 74 |
$schema['context_ui_item'] = array(
|
| 75 |
'description' => t('context_ui_item.'),
|
| 76 |
'fields' => array(
|
| 77 |
'type' => array(
|
| 78 |
'description' => t('?'),
|
| 79 |
'type' => 'varchar',
|
| 80 |
'length' => 32,
|
| 81 |
'not null' => TRUE,
|
| 82 |
'default' => '',
|
| 83 |
),
|
| 84 |
'id' => array(
|
| 85 |
'description' => t('?'),
|
| 86 |
'type' => 'varchar',
|
| 87 |
'length' => 255,
|
| 88 |
'not null' => TRUE,
|
| 89 |
'default' => '',
|
| 90 |
),
|
| 91 |
'cid' => array(
|
| 92 |
'description' => t('?'),
|
| 93 |
'type' => 'int',
|
| 94 |
'unsigned' => TRUE,
|
| 95 |
'not null' => TRUE,
|
| 96 |
'default' => 0,
|
| 97 |
),
|
| 98 |
),
|
| 99 |
'unique keys' => array(
|
| 100 |
'key1' => array('id', 'type', 'cid'),
|
| 101 |
),
|
| 102 |
/* 'primary key' => array(''), */
|
| 103 |
);
|
| 104 |
|
| 105 |
$schema['context_ui_block'] = array(
|
| 106 |
'description' => t('context_ui_block.'),
|
| 107 |
'fields' => array(
|
| 108 |
'module' => array(
|
| 109 |
'description' => t('?'),
|
| 110 |
'type' => 'varchar',
|
| 111 |
'length' => 64,
|
| 112 |
'not null' => TRUE,
|
| 113 |
'default' => '',
|
| 114 |
),
|
| 115 |
'delta' => array(
|
| 116 |
'description' => t('?'),
|
| 117 |
'type' => 'varchar',
|
| 118 |
'length' => 32,
|
| 119 |
'not null' => TRUE,
|
| 120 |
'default' => '',
|
| 121 |
),
|
| 122 |
'region' => array(
|
| 123 |
'description' => t('?'),
|
| 124 |
'type' => 'varchar',
|
| 125 |
'length' => 64,
|
| 126 |
'not null' => TRUE,
|
| 127 |
'default' => '',
|
| 128 |
),
|
| 129 |
'weight' => array(
|
| 130 |
'description' => t('?'),
|
| 131 |
'type' => 'int',
|
| 132 |
'size' => 'tiny',
|
| 133 |
'not null' => TRUE,
|
| 134 |
'default' => 0,
|
| 135 |
),
|
| 136 |
'cid' => array(
|
| 137 |
'description' => t('?'),
|
| 138 |
'type' => 'int',
|
| 139 |
'unsigned' => TRUE,
|
| 140 |
'not null' => TRUE,
|
| 141 |
'default' => 0,
|
| 142 |
),
|
| 143 |
),
|
| 144 |
'unique keys' => array(
|
| 145 |
'key1' => array('module', 'delta', 'region', 'cid'),
|
| 146 |
),
|
| 147 |
/* 'primary key' => array(''), */
|
| 148 |
);
|
| 149 |
|
| 150 |
return $schema;
|
| 151 |
}
|
| 152 |
|
| 153 |
function context_ui_update_1() {
|
| 154 |
$ret = array();
|
| 155 |
switch ($GLOBALS['db_type']) {
|
| 156 |
case 'mysql':
|
| 157 |
case 'mysqli':
|
| 158 |
$ret[] = update_sql("ALTER TABLE {context_ui} CHANGE COLUMN space namespace VARCHAR(64) NOT NULL");
|
| 159 |
$ret[] = update_sql("ALTER TABLE {context_ui} CHANGE COLUMN ckey attribute VARCHAR(64) NOT NULL");
|
| 160 |
break;
|
| 161 |
}
|
| 162 |
return $ret;
|
| 163 |
}
|