You are here

function view_custom_table_schema in Views Custom Table 7

Implements hook_schema().

File

./view_custom_table.install, line 11
Installation functions for the View Custom Table module.

Code

function view_custom_table_schema() {
  $schema['custom_table_view_data'] = array(
    'description' => 'Keep the records of custom tables added in views.',
    'fields' => array(
      'id' => array(
        'description' => 'Primary id for the table.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'table_name' => array(
        'description' => 'Table name which needs to add to views.',
        'type' => 'varchar',
        'length' => 100,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'Table description for a quick idea of, what this table for.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'column_relations' => array(
        'description' => 'Custom table relation with drupal core entities.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'created_by' => array(
        'description' => 'Relation to the user who has created this entry.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'indexes' => array(
      'table_name' => array(
        'table_name',
      ),
      'description' => array(
        'description',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  return $schema;
}