This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
suitedesk/modules/storm/stormnote/stormnote.install

76 lines
2.3 KiB
Text

<?php
/**
* @file
*/
function stormnote_install() {
drupal_install_schema('stormnote');
variable_set('node_options_stormnote', array('status'));
}
function stormnote_disable() {
drupal_set_message(t('Nodes of type "Note" have not been deleted on disabling SuiteDesk Note. Please note that they will now have reduced functionality, and will not be protected by SuiteDesk Note access controls.'), 'warning');
}
function stormnote_uninstall() {
drupal_uninstall_schema('stormnote');
}
function stormnote_schema() {
$schema['stormnote'] = array(
'fields' => array(
'vid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'organization_nid' => array('type' => 'int'),
'organization_title' => array('type' => 'varchar', 'length' => 128),
'project_nid' => array('type' => 'int'),
'project_title' => array('type' => 'varchar', 'length' => 128),
'task_nid' => array('type' => 'int'),
'task_title' => array('type' => 'varchar', 'length' => 128),
'version' => array('type' => 'varchar', 'length' => 12),
),
'primary key' => array('vid'),
'indexes' => array(
'nid' => array('nid'),
'organization_nid' => array('organization_nid'),
'project_nid' => array('project_nid'),
'task_nid' => array('task_nid'),
),
);
return $schema;
}
/**
* @function
* Update function to remove task_stepno field from stormnote table
*/
function stormnote_update_6101() {
$ret = array();
db_drop_field($ret, 'stormnote', 'task_stepno');
return $ret;
}
/**
* Improve primary keys and indexes
*/
function stormnote_update_6201() {
$return = array();
db_drop_primary_key($return, 'stormnote');
db_add_primary_key($return, 'stormnote', array('vid'));
$indexes = array(
'nid' => array('nid'),
'organization_nid' => array('organization_nid'),
'project_nid' => array('project_nid'),
'task_nid' => array('task_nid'),
);
foreach ($indexes as $name => $fields) {
db_add_index($return, 'stormnote', $name, $fields);
}
return $return;
}