function forena_update_7201 in Forena Reports 7.3
Same name and namespace in other branches
- 7.2 forena.install \forena_update_7201()
Updating database schema
File
- ./
forena.install, line 72 - Installation api for module
Code
function forena_update_7201() {
$schema = array();
$schema['forena_repositories'] = array(
'fields' => array(
'repository' => array(
'type' => 'varchar',
'length' => 63,
'not null' => TRUE,
),
'title' => array(
'type' => 'varchar',
'length' => 63,
),
'enabled' => array(
'type' => 'int',
'not null' => TRUE,
),
'config' => array(
'type' => 'text',
),
),
'primary_key' => array(
'repository',
),
);
$schema['forena_data_blocks'] = array(
'fields' => array(
'repository' => array(
'type' => 'varchar',
'length' => '63',
'not null' => TRUE,
),
'block_name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'title' => array(
'type' => 'varchar',
'length' => 63,
'not null' => FALSE,
),
'descriptor' => array(
'type' => 'varchar',
'length' => '255',
),
'category' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
),
'modified' => array(
'type' => 'int',
),
'src' => array(
'type' => 'text',
),
'locked' => array(
'type' => 'int',
'not null' => TRUE,
),
),
'primary key' => array(
'block_name',
),
'indexes' => array(
'category' => array(
'category',
),
'repository' => array(
'repository',
),
),
);
if (!db_field_exists('forena_reports', 'descriptor')) {
db_add_field('forena_reports', 'descriptor', array(
'type' => 'text',
));
}
if (!db_field_exists('forena_reports', 'altered')) {
db_add_field('forena_reports', 'altered', array(
'type' => 'int',
));
}
if (!db_table_exists('forena_reports')) {
db_create_table('forena_repositories', $schema['forena_repositories']);
}
if (!db_table_exists('forena_data_blocks')) {
db_create_table('forena_data_blocks', $schema['forena_data_blocks']);
}
}