sbp_attach.install in Search by Page 7
Same filename and directory in other branches
Install hooks for sbp_attach module
File
sbp_attach.installView source
<?php
/**
* @file
* Install hooks for sbp_attach module
*/
/**
* Implements hook_schema().
*/
function sbp_attach_schema() {
$schema['sbpa_attachments'] = array(
'description' => 'Attachments that have been indexed',
'fields' => array(
'sbpaid' => array(
'description' => 'Primary key',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'environment' => array(
'description' => 'Search by Page environment ID',
'type' => 'int',
'size' => 'big',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'objtype' => array(
'description' => '{field_config_instance}.object_type - type of object field is attached to',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'objid' => array(
'description' => 'Entity object ID, usually node.nid, of object field is attached to',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'bundle' => array(
'description' => '{field_config_instance}.bundle - bundle field is attached to',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'fieldname' => array(
'description' => '{field_config}.field_name - field name',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'fileid' => array(
'description' => '{files}.fid - file ID',
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
'display' => array(
'description' => '1 if this file is marked displayed, 0 if not',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array(
'sbpaid',
),
'indexes' => array(
'env' => array(
'environment',
),
'objid' => array(
'objid',
),
'objtype' => array(
'objtype',
),
'display' => array(
'display',
),
),
);
return $schema;
}
/**
* Implements hook_update_N().
*
* Creates a totally new database structure for Drupal 7.
*/
function sbp_attach_update_7001() {
db_drop_table('sbpa_files');
$schema = array();
$schema['sbpa_attachments'] = array(
'description' => 'Attachments that have been indexed',
'fields' => array(
'sbpaid' => array(
'description' => 'Primary key',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'environment' => array(
'description' => 'Search by Page environment ID',
'type' => 'int',
'size' => 'big',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'objtype' => array(
'description' => '{field_config_instance}.object_type - type of object field is attached to',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'objid' => array(
'description' => 'Entity object ID, usually node.nid, of object field is attached to',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'bundle' => array(
'description' => '{field_config_instance}.bundle - bundle field is attached to',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'fieldname' => array(
'description' => '{field_config}.field_name - field name',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'fileid' => array(
'description' => '{files}.fid - file ID',
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
'display' => array(
'description' => '1 if this file is marked displayed, 0 if not',
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array(
'sbpaid',
),
'indexes' => array(
'env' => array(
'environment',
),
'objid' => array(
'objid',
),
'objtype' => array(
'objtype',
),
'display' => array(
'display',
),
),
);
db_create_table('sbpa_attachments', $schema['sbpa_attachments']);
}
Functions
Name | Description |
---|---|
sbp_attach_schema | Implements hook_schema(). |
sbp_attach_update_7001 | Implements hook_update_N(). |