<?php

/**
 * Implementation of hook_schema().
 *
 * @ingroup tripal
 */
function tripal_ws_schema() {
  $schema = array();
  $schema['tripal_sites'] = tripal_ws_tripal_sites_schema();
  return $schema;
}

/**
 * The base table for TripalVocab schema.
 *
 * Table to store information about other Tripal sites.
 */
function tripal_ws_tripal_sites_schema() {
  $schema = array(
    'description' => 'The table for other Tripal sites.',
    'fields' => array(
      'id' => array(
        'description' => 'The primary identifier for a record.',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'name' => array(
        'description' => 'Name of the Tripal site',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'url' => array(
        'description' => 'The URL of the Tripal site.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'version' => array(
        'description' => 'The web services version of the Tripal site.',
        'type' => 'varchar',
        'length' => 255,
      ),
      'description' => array(
        'description' => 'The description of the Tripal site.',
        'type' => 'text'
      ),
    ),
    'indexes' => array(
      'name' => array('name'),
      'url' => array('url'),
      'description' => array('description'),
    ),
    'unique keys' => array(
      'tripal_sites_c1' => array('url', 'version'),
      'tripal_sites_c2' => array('name')
    ),
    'primary key' => array('id'),
  );
  return $schema;
}