You are here

function forena_update_6201 in Forena Reports 6.2

Updating database schema

File

./forena.install, line 85
Installation api for module

Code

function forena_update_6201() {
  $ret = array();
  $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',
      ),
    ),
  );
  db_add_field($ret, 'forena_reports', 'descriptor', array(
    'type' => 'text',
  ));
  db_add_field($ret, 'forena_reports', 'src', array(
    'type' => 'text',
  ));
  db_add_field($ret, 'forena_reports', 'altered', array(
    'type' => 'int',
  ));
  db_create_table($ret, 'forena_repositories', $schema['forena_repositories']);
  db_create_table($ret, 'forena_data_blocks', $schema['forena_data_blocks']);
  return $ret;
}